用matplotlib绘制Pandas数据帧图

2024-05-18 23:33:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用matplotlib将开盘价显示为x轴,安全名称显示为y轴,因为我的数据存储在pandas dataframe图形结果中没什么。谢谢你的帮助。在

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'是我的表名包含股票数据这里是我的数据链接 https://drive.google.com/open?id=0B_RSbeIckLLeR0ZJelQtY0tUbTQ


Tags: of数据matplotlibpackagesnpopenrequestsprice
1条回答
网友
1楼 · 发布于 2024-05-18 23:33:33

我想您需要添加thousands=','参数来删除,中的floats:

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=',')

然后^{}

^{pr2}$

但有很多数据:

graph

相关问题 更多 >

    热门问题