I have the following DataFrame:
df = pd.DataFrame({
'Trader': 'Carl Mark Carl Joe Mark Carl Max Max'.split(),
'Share': list('ABAABAAA'),
'Quantity': [5,2,5,10,1,5,2,1]
}, index=[
DT.datetime(2013,1,1,13,0),
DT.datetime(2013,1,1,13,5),
DT.datetime(2013,1,1,20,0),
DT.datetime(2013,1,2,10,0),
DT.datetime(2013,1,2,12,0),
DT.datetime(2013,1,2,14,0),
DT.datetime(2013,6,2,14,0),
DT.datetime(2013,7,2,14,0),
])
Is it possible to create a Period object on a daily basis which abstracts from the concrete day. I would like to evaluate the question whether there is a tendency among the traders in the sample to trade lower volumes.
To do so I would like to create a table like this:
Period | Trader | Quantity
--------------------------
1 | Carl | 10
1 | Mark | 2
1 | Joe | 10
1 | Max | 2
2 | Carl | 5
2 | Mark | 1
2 | Max | 1
Andy
Update:
The Datasampel above was too simple to show my problem. I hope to create a period object which abstracts from the concrete date. My goal is to compare the sequence of the occurred trades per trader.
df1 = pd.DataFrame({
'Trader': 'Carl Mark Carl Joe Mark Carl Max Max'.split(),
'Share': list('ABAABAAA'),
'Quantity': [5,2,5,10,1,5,2,1]
}, index=[
DT.datetime(2013,1,1,13,0),
DT.datetime(2013,1,1,13,5),
DT.datetime(2013,1,1,20,0),
DT.datetime(2013,2,6,10,0),
DT.datetime(2013,2,5,12,0),
DT.datetime(2013,3,7,14,0),
DT.datetime(2013,6,4,14,0),
DT.datetime(2013,7,4,14,0),
])