How to divide a dataset according to a value in a column?

181 views Asked by At

I have a pandas data frame with a column that represents dates as:

Name: ts_placed, Length: 13631, dtype: datetime64[ns]

It looks like this ( it was recoded using week as time unit):

0     42
1     44
2     44
3     41
4     43
5     45
6     46
...

What I want to do is to create a new pandas data frame for each week. In other words, I should obtain a data frame that contains only elements that have the value 42 in the column 'ts_placed' a data frame that contains only elements that have the value 43 in the column 'ts_placed' and so on.

0

There are 0 answers