How to plot a time after conversion
I want to convert one column to time and then plot it. What I did is this:
df = pd.read_csv('vv.txt',sep=" ",names=list(["time", "size", "type"]))
df.time = df.time.apply(lambda X: "{0:02.0f}:{1:02.0f}".format(*divmod(float(X) * 60, 60)))
df["time"] = pd.to_datetime(df["time"], format='%H:%M' ).apply(pd.Timestamp)
df["time"] = df["time"].map(lambda x: x.strftime("%H:%M"))
plt.scatter(df['time'], df['size'])
and it shows this as a result, no X-axis is showing right. How can I solve this?
from Recent Questions - Stack Overflow https://ift.tt/3vXLAVI
https://ift.tt/2Y3ecQY
Comments
Post a Comment