parse_ticker_dataframe: group dataframe by date
This commit is contained in:
parent
131dfaf263
commit
02aacdd0c8
@ -50,6 +50,14 @@ class Analyze(object):
|
|||||||
.rename(columns=columns)
|
.rename(columns=columns)
|
||||||
if 'BV' in frame:
|
if 'BV' in frame:
|
||||||
frame.drop('BV', 1, inplace=True)
|
frame.drop('BV', 1, inplace=True)
|
||||||
|
# group by date to eliminate duplicate ticks
|
||||||
|
frame.groupby('date').agg({
|
||||||
|
'volume': 'max',
|
||||||
|
'open': 'first',
|
||||||
|
'close': 'last',
|
||||||
|
'high': 'max',
|
||||||
|
'low': 'min',
|
||||||
|
})
|
||||||
frame['date'] = to_datetime(frame['date'], utc=True, infer_datetime_format=True)
|
frame['date'] = to_datetime(frame['date'], utc=True, infer_datetime_format=True)
|
||||||
frame.sort_values('date', inplace=True)
|
frame.sort_values('date', inplace=True)
|
||||||
return frame
|
return frame
|
||||||
|
Loading…
Reference in New Issue
Block a user