I have a pandas data frame that looks like this:
x | week
___________________
234 | 40
345 | 40
123 | 41
155 | 41
213 | 41
... | ...
1452 | 52
and I need to create several data frames that each contains only one week
one for week 40, one for week 41, etc.
I have tried this so far:
length = len(data.index)-1
firstweek=data['week'].iloc[0]
lastweek=data['week'].iloc[length]
df = {}
for i in range (firstweek,lastweek):
df[i]= pd.DataFrame(data.query('week== i'))