我正在尝试根据日期绘制信息。我有一个日期列表,格式为“01/02/1991”。
我通过以下方式进行转换:
x = parser.parse(date).strftime('%Y%m%d'))
这将给出19910102
然后我尝试使用num2date。
import matplotlib.dates as dates
new_x = dates.num2date(x)
绘图:
plt.plot_date(new_x, other_data, fmt="bo", tz=None, xdate=True)
但是我收到了一个错误。它说“ValueError: year is out of range”。有什么解决办法吗?