python date2num_坚持mdates.date2num

我一直在尝试寻找使用mdates.date2num的解决方案,但是尽管尝试了一些方法,我还是有错误。在

这是我的代码:import matplotlib.pyplot as plt

import numpy as np

import urllib

import matplotlib.dates as mdates

#from matplotlib.dates import bytespdate2num

'''

datefunc = lambda x: mdates.date2num(datetime.strptime(x, '%Y%m%d'))

'''

def graph_data(stock):

fig = plt.figure()

ax1 = plt.subplot2grid((1,1), (0,0),)

stock_price_url =('http://chartapi.finance.yahoo.com/instrument/1.0/+stock+/chartdata;type=quote;range=10y/csv')

source_code = urllib.request.urlopen(stock_price_url).read().decode()

stock_data = []

spilt_source = source_code.split('\n')

for line in source_code:

spilt_line = line.split(',')

if len(spilt_line) =&#

你可能感兴趣的:(python,date2num)