问题
I'm trying to create a histogram with two data sets overlying each other, however whenever I plot it using pandas.DataFrame.hist(), it creates two graphs:

The code is simply:
ratios.hist(bins = 100)
plt.show()
where ratios is just a DataFrame, 2 columns by about 7000 rows. Any idea on how to put the two graphs on the same axis?
回答1:
Try plot.hist instead:
ratios = pd.DataFrame(np.random.normal((1, 2), size=(100, 2)))
ratios.hist(bins=10)
This generates:
ratios.plot.hist(alpha=0.5, bins=10)
This, on the other hand, puts them on the same graph:
来源:https://stackoverflow.com/questions/39529941/plotting-histograms-in-python-using-pandas