I have a Pandas series, ts.
Date
2020-06-02 10.02
2020-06-03 10.45
2020-06-04 10.95
2020-06-05 11.23
For plotting purposes, I convert the index into strings by first converting it into a dataframe. Then apply a lambda expression followed by extracting it out as a Pandas series.
dfn = ts.to_frame()
dfn.index = dfn.reset_index().apply(lambda x: x['Date'].strftime('%Y-%m-%d'), axis=1)
tsn = dfn.iloc[:, 0]
Is there a more efficient way of doing it?