A tutorial for older versions of python and matplotlib contains code like this:
def graphRawFX ():
date,bid,ask = np.loadtxt('GBPUSD1d.txt',
unpack=True,
delimiter=',',
converters={0:mdates.strpdate2num('%Y%m%d%H%M%S')})
fig = plt.figure(figsize=(10,7))
ax1 = plt.subplot2grid((40,40),(0,0), rowspan=40,colspan=40)
ax1.plot(date,bid)
ax1.plot(date,ask)
ax1.xaxis.set_major_formatter(mdates.DateFormatter('%Y-%m-%d %H:%M:%S'))
plt.grid(True)
plt.show()
graphRawFX()
I get the following error when I run the code:
The strpdate2num class was deprecated in Matplotlib 3.1 and will be removed in 3.3. Use time.strptime or dateutil.parser.parse or datestr2num instead.
converters={0:mdates.strpdate2num('%Y%m%d%H%M%S')})
Here is one row of the data for more information:
20130501000000,1.55358,1.55371
so how do I turn that string into dates using matplotlib 3.1?
converters={0:lambda x: mdates.date2num(datetime.strptime(x, '%Y%m%d%H%M%S'))}