2017-06-24 94 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

相關問題