I need some help manipulating the contents of a .csv file.
My file looks like this:
I need to group the contents by "Council District" and then by "TYPENAME" and display their totals. I then need to store the result in 3 different columns like so:
I tried accomplishing this with this code:
ds=pd.read_csv(r"myfile.csv")
ds.info()
ds.keys()
ds=pd.read_csv("myfile.csv")
grouped=(ds.groupby(['Council District','TYPENAME']).size().to_frame("Count"))
grouped.to_csv(r"request_by_districtTEST.csv")
print(grouped.head())
grouped.describe(include='all')
grouped.keys()
But instead of having 3 separate columns I only get one:
Anyone knows how can I fix my code so it stores it into 3 separate columns?