I have to do the tasks below, but some parts do not work out properly. Here are the steps:
- Converting a dataframe with unix timestamps to a dataframe with datetime values, works with the following code:
datetime_df = pd.to_datetime(unix_df, unit='s')
- Resampling the datetime with
smpl = datetime_df[0].resample('10min')
- Converting it back to unix timestamp format with:
unix_df = datetime_df.astype(np.int64) // 10 ** 9
Step 1 and 3 work, but step 2 doesn't work because Python tells me it needs a DateTimeIndex and I don't know how to set it. The strange thing is that the index completely disappears after to_datetime
, so I tried creating a list and then making a dataframe from it again, but it still didn't work. Somebody can help me?