Home > Blockchain >  Pandas dataframe plot time axis format total seconds into elapsed HH:MM:SS
Pandas dataframe plot time axis format total seconds into elapsed HH:MM:SS

Time:02-16

I have a pandas dataframe where index value are integers 0-10000 and each value corresponds to 1 second. I have 1 temp column in dataframe. I can create a plot of temp vs time using matplotlib:

import matplotlib.pyplot as plt
df.plot()
plt.show()

With this time is displayed on x-axis in seconds (index value), I'd like to display time in a more readable way for example 50min 5 sec, instead of 3005 seconds. Thanks for any help

CodePudding user response:

index value are integers 0-10000 and each value corresponds to 1 second

Convert the index figure with timedelta axis

  • Related