I have a data frame, data_plot
looks like the following,
After operating the data_plot
as follows
data_plot['Time'] = pd.to_datetime(data_plot['Time'])
df = data_plot.resample('M', on='Time').sum()
I got df
as follows, the Time column
has become into index column.
I have to use df.reset_index(inplace=true) to ensure 'Time' column not index column. If I want to avoid the last step of reset_index
, how to modify the step of df = data_plot.resample('M', on='Time').sum()