2017-06-24 98 views
-1

大家我想显示开放价格作为X轴和安全名称作为Y轴使用matplotlib作为我的数据存储在熊猫数据框图结果nothing.thank你的帮助。使用matplotlib绘制熊猫数据框图

import requests.packages.urllib3 
requests.packages.urllib3.disable_warnings() 


dfs = pd.read_excel('Movement of BSE RIK.xlsx',header=0,dtype={'Open Price (Rs.)':np.float64,'Close Price (Rs.)':np.float64}, sheetname=None) 
xl=pd.ExcelFile('Movement of BSE RIK.xlsx',header=0,dtype={'Open Price (Rs.)':np.float64}) 
p=xl.sheet_names 




matplotlib.style.use('ggplot') 
print(dfs['D-0']['Open Price (Rs.)']) 
plt.plot(y=dfs['D-0']['Open Price (Rs.)'], x=dfs['D-0']['Security Name'], kind='bar') 
plt.show() 

这里 'd-0' 是我SHEETNAME包含在这里的股票数据是我的数据的链接 https://drive.google.com/open?id=0B_RSbeIckLLeR0ZJelQtY0tUbTQ

回答

1

我认为你需要在float的add thousands=','参数删除,

dfs = pd.read_excel('Movement of BSE RIK.xlsx', 
        header=0, 
        dtype={'Open Price (Rs.)':np.float64,'Close Price (Rs.)':np.float64}, 
        sheetname=None, 
        thousands=',') 

然后DataFrame.plot.bar

dfs['D-0'].plot.bar(y='Open Price (Rs.)', x='Security Name') 

但有大量的数据:

graph

相关问题