While I don't know of anything that parses text into timedelta
, the format you have specified is understood by the pandas.Timedelta
constructor, so if you want, you can use that to construct your timedeltas:
import pandas as pd
import matplotlib.pyplot as plt
x = [['5 days, 4:23:52.480000', 17.647166],
['5 days, 5:56:09.166000', 22.916071],
['5 days, 8:21:40.261000', 18.922329],
['5 days, 9:53:18.070000', 21.392157],
['6 days, 0:07:54.487000', 20.275597]]
df = pd.DataFrame(x, columns=['TimeOffset', 'Value'])
df['TimeOffset'] = df['TimeOffset'].apply(pd.Timedelta)
plt.plot(df['TimeOffset'], df['Value'])
plt.show()
People who know pandas better, feel free to edit this answer (and remove this message) - I feel like the way I constructed the pd.Timedelta
column may be non-idiomatic.