我正在尝试绘制我使用Pandas DataReader从世界银行导入的数据帧。但是当我绘制它的时候,它显示了一个奇怪的图。年份列和x轴显示不正确。我该怎么办?谢谢。
[
from pandas_datareader import wb
import datetime
ind = ['NY.GNP.PCAP.CD']
df = wb.download(indicator=ind, country='CHN', start=2000, end=2021)
df.head()
df.plot()
NY.GNP.PCAP.CD
country year
China 2020 10610
2019 10390
2018 9600
2017 8740
2016 8270
发布于 2021-07-18 21:05:42
from pandas_datareader import wb
import pandas as pd
import matplotlib.pyplot as plt
import datetime
ind = ['NY.GNP.PCAP.CD']
df = wb.download(indicator=ind, country='CHN', start=2000, end=2021)
然后,您可以像这样使用pd.plotting.scatter_matrix():
pd.plotting.scatter_matrix(df)
plt.show()
在输出中,你可以看到像这样的直方图:
https://stackoverflow.com/questions/68429141
复制相似问题