Dataframe use groupby precautions
In the case of knowing that there are many rows of data for each date, if we combine a certain column of data according to the date
Then use the groupby function
But when the dataframe is used directly, an error is reported. In desperation, the dataframe can only be saved locally, and then read again. After using this function, save it at last
df_1_weekday_morning.to_csv('路段1早高峰.csv',encoding = 'utf_8_sig')
df_1_weekday_morning_new = pd.read_csv('路段1早高峰.csv')
df_1_weekday_morning_new = df_1_weekday_morning_new.groupby('date').sum()
df_1_weekday_morning_new.to_csv('路段1早高峰.csv',encoding = 'utf_8_sig')
Well, finally achieved such a result
Well, finally achieved such a result