I have a large dataset with over 50 columns and 30,000 rows. One of those columns is "Region" and has the following possible values ["Europe", "Americas", "Asia"]
I wanted to create a simple table which groups all the regions and counts how many instances there are.
This is the code I am using
df_grouped = df.groupby('Region')['Date'].count()
I instead get a table like this:
Region Date
1,0000.00 1
10,000.00 1
10,300.00 1
134,104,360.34 1
.... ....
iA 1
iBBB- 2
null 30
Can someone explain to me why this happens? I tried with other columns and I get similar results. I expected the table just have 3 rows with the total count indicated on the right hand side.
Thanks
question from:
https://stackoverflow.com/questions/65834971/python-using-groupby-on-pandas-dataframe-returns-numbers-instead-of-values 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…