0

I have a dataframe like this

crdf = pd.DataFrame(Maindf.loc[Maindf['Symbol'] == 'ICICIBANK']).set_index(['TimeStamp'])
crdf.index = pd.to_datetime(crdf.index)
crdf['Ltp'] = crdf['Ltp'].astype('float64')
crdf['Volume'] = crdf['Volume'].astype('float64')


                      Symbol     Ltp    Volume
TimeStamp                                          
1970-01-01 05:30:00 AM  ICICIBANK  371.15  34111143

This dataframe is getting the tick data and is constantly getting updated

I want to resample this dataframe at the end on 1 min to get the

Open = First(Ltp)
Low = Min(Ltp)
High = Max(Ltp)
Close = Last(Ltp)

and Volume = Last(Volume)

Rcrdf = crdf.resample('1Min').ohlc()

I am using resample function but i am getting error DataError: No numeric types to aggregate

Can someone please help how to resample this

Abhishek
  • 1
  • 1
  • Not sure why this was closed as a duplicate of Change data type. That is not the problem. Try: Rcrdf = crdf.ltp.resample('1Min').ohlc() – Robert Altena Aug 22 '20 at 14:37
  • yes that works and for volume i am getting total volume as ticks but i want the 1 min volume so how should i handle that – Abhishek Aug 22 '20 at 18:23
  • This question has gone a little off track. Why don't you ask a new one, and link to it here? (not really your fault, stackoverflow can be weird). I can then answer. Also consider up-voting replies you get. Be nice! – Robert Altena Aug 22 '20 at 23:18

0 Answers0