As a newbie in coding, I don't understand fully if I can use matplotlib.dates.DateFormatter()
without reservation, knowing that the function rely on strftime()
which is deprecated.
I was trying to fix a tick issue (how to change date format for xlabel ticks) and ran into this effective solution
This solution rely on matplotlib.dates.DateFormatter()
.
This is my code using this function:
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
fig, ax = plt.subplots()
plt.plot(df.loc[:, "LAST_PRICE"])
hourFmt = mdates.DateFormatter('%H')
ax.xaxis.set_major_formatter(hourFmt)
plt.show()
This solution works fine.
The problem is that when trying to understand the function, I read that strftime()
is deprecated
Is it reasonable to use this function in my code, and if yes, why?
Thank you for your help