1

Here is my code to plot col_A vs. time:

ax[0].plot(data_df['time'], data_df['col_A'] , color = 'black')

The the plot looks like this:

enter image description here

The x-axis time is currently in "epoch timestamp" unit (https://www.freeformatter.com/epoch-timestamp-to-date-converter.html). Can I display the x-axis using the regular date in the plot? Thanks!

Edamame
  • 23,718
  • 73
  • 186
  • 320
  • Why don't you just either convert the timestamp before plotting or create a new column in the format you want? See [this](https://stackoverflow.com/questions/19231871/convert-unix-time-to-readable-date-in-pandas-dataframe) for example. There's plenty of examples on Google. – roganjosh Mar 15 '18 at 19:21
  • 1
    Does it work if you add `data_df['time'].astype('datetime64[s]')` instead of only `data_df['time']` inside `plot` function? – niraj Mar 15 '18 at 19:23

1 Answers1

1

You can try adding data_df['time'].astype('datetime64[s]') instead of only data_df['time'] inside plot function:

ax[0].plot(data_df['time'].astype('datetime64[s]'), data_df['col_A'] , color = 'black')
niraj
  • 17,498
  • 4
  • 33
  • 48