我有以下数据框,例如mydata
:
1 10 100 ... 97 98 99
0 23.53500 23.53500 23.53500 ... 23.53500 23.53500 23.53500
1 24.20000 24.20000 24.20000 ... 24.20000 24.20000 24.20000
2 23.71500 23.71500 23.71500 ... 23.71500 23.71500 23.71500
3 23.24000 23.24000 23.24000 ... 23.24000 23.24000 23.24000
4 22.79500 22.79500 22.79500 ... 22.79500 22.79500 22.79500
5 18.70150 18.70150 18.70150 ... 18.70150 18.70150 18.70150
6 10.56550 10.56550 10.56550 ... 10.56550 10.56550 10.56550
7 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
8 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
9 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
10 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
11 1.24300 1.24300 1.24300 ... 1.24300 1.24300 1.24300
12 7.68400 7.68400 7.68400 ... 7.68400 7.68400 7.68400
13 1.46900 1.46900 1.46900 ... 1.46900 1.46900 1.46900
14 10.50900 10.50900 10.50900 ... 10.50900 10.50900 10.50900
15 18.58850 18.58850 18.58850 ... 18.58850 18.58850 18.58850
16 22.93500 22.93500 22.93500 ... 22.93500 22.93500 22.93500
17 23.54500 23.54500 23.54500 ... 23.54500 23.54500 23.54500
18 24.21500 24.21500 24.21500 ... 24.21500 24.21500 24.21500
19 25.23000 25.23000 25.23000 ... 25.23000 25.23000 25.23000
20 25.88100 25.88100 25.88100 ... 25.88100 25.88100 25.88100
21 26.33775 26.33775 26.33775 ... 26.33775 26.33775 26.33775
22 26.72000 26.72000 26.72000 ... 26.72000 26.72000 26.72000
23 26.98000 26.98000 26.98000 ... 26.98000 26.98000 26.98000
24 27.19500 27.19500 27.19500 ... 27.19500 27.19500 27.19500
25 27.34500 27.34500 27.34500 ... 27.34500 27.34500 27.34500
26 27.52000 27.52000 27.52000 ... 27.52000 27.52000 27.52000
27 27.86500 27.86500 27.86500 ... 27.86500 27.86500 27.86500
28 28.41500 28.41500 28.41500 ... 28.41500 28.41500 28.41500
29 29.06750 29.06750 29.06750 ... 29.06750 29.06750 29.06750
... ... ... ... ... ... ...
6931 28.61000 28.61000 28.61000 ... 28.61000 28.61000 28.61000
6932 28.97825 28.97825 28.97825 ... 28.97825 28.97825 28.97825
6933 29.06225 29.06225 29.06225 ... 29.06225 29.06225 29.06225
6934 28.49000 28.49000 28.49000 ... 28.49000 28.49000 28.49000
6935 27.56000 27.56000 27.56000 ... 27.56000 27.56000 27.56000
6936 26.64225 26.64225 26.64225 ... 26.64225 26.64225 26.64225
6937 26.15400 26.15400 26.15400 ... 26.15400 26.15400 26.15400
6938 26.16450 26.16450 26.16450 ... 26.16450 26.16450 26.16450
6939 25.95450 25.95450 25.95450 ... 25.95450 25.95450 25.95450
6940 25.62900 25.62900 25.62900 ... 25.62900 25.62900 25.62900
6941 25.32975 25.32975 25.32975 ... 25.32975 25.32975 25.32975
6942 24.85725 24.85725 24.85725 ... 24.85725 24.85725 24.85725
6943 24.06500 24.06500 24.06500 ... 24.06500 24.06500 24.06500
6944 23.15000 23.15000 23.15000 ... 23.15000 23.15000 23.15000
6945 19.43600 19.43600 19.43600 ... 19.43600 19.43600 19.43600
6946 14.06850 14.06850 14.06850 ... 14.06850 14.06850 14.06850
6947 9.15300 9.15300 9.15300 ... 9.15300 9.15300 9.15300
6948 4.57650 4.57650 4.57650 ... 4.57650 4.57650 4.57650
6949 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6950 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6951 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6952 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6953 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6954 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6955 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6956 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6957 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6958 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6959 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
6960 0.00000 0.00000 0.00000 ... 0.00000 0.00000 0.00000
[6961 rows x 149 columns]
我想创建所有数据的频率分布/直方图(所以6961x149
)。我尝试使用matplotlib
和dataframe.hist()
进行的所有尝试都区分了数据帧中的每一列,这不是我想要的。我能以某种方式编写代码,使plot函数不能区分列和行,而只是对te数据帧中的所有值进行直方图绘制吗?
示例代码和图形:
import matplotlib.pyplot as plt
plt.hist(mydata.values,bins=20)
plt.show()
mydata.plot.hist()
结果: