0

I have a data frame, data_plot looks like the following,

enter image description here

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.

enter image description here

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()

enter image description here

user785099
  • 5,323
  • 10
  • 44
  • 62

0 Answers0