I have a dataframe and i want to calculate every 12 hours mean for all the columns. dataframe has more than 200k rows.
          DateTime Speed   TRQ         ...    PtoP3  RMS3   Crest3
0       2016-07-01 00:00   994  35.4   ...       NA    NA       NA
1       2016-07-01 00:01   995  34.6   ...       NA    NA       NA
2       2016-07-01 00:02   995    34   ...       NA    NA       NA
i wrote this
Present_data.to_datetime(Present_data['DateTime'])
Total_12hravg_all = Present_data.groupby(pd.Grouper(freq='12H', key='DateTime')).mean()
print(Total_12hravg_all)
and got this error
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'Index'
 
     
    