Python cut data according to categorical variables

1 i_week=data_365['星期'].unique()
2 for temp1 in i_week:
3     temp_data=width_365[data_365['星期'].isin([temp1])]
4     exec("df%s = temp_data"%temp1)
5 del temp1,temp_data,i_week

 

The data set data_365 is a year of data, and there is a variable 'week' which is a categorical variable

The purpose is to separate the data on Monday, Tuesday, Wednesday, Friday, and Friday and form a DataFrame

Facilitates other inspections

 

Guess you like

Origin www.cnblogs.com/shilo930/p/12691941.html