我有一个Python熊猫系列的某些值(类型:pandas.core.series.Series
)
In [1]: series = pd.Series([0.0,950.0,-70.0,812.0,0.0,-90.0,0.0,0.0,-90.0,0.0,-64.0,208.0,0.0,-90.0,0.0,-80.0,0.0,0.0,-80.0,-48.0,840.0,-100.0,190.0,130.0,-100.0,-100.0,0.0,-50.0,0.0,-100.0,-100.0,0.0,-90.0,0.0,-90.0,-90.0,63.0,-90.0,0.0,0.0,-90.0,-80.0,0.0,])
In [2]: series.min()
Out[2]: -100.0
In [3]: series.max()
Out[3]: 950.0
我想获取直方图的值(不必绘制直方图)...我只需要获取每个间隔的频率即可。
假设我的间隔从[-200; -150]至[950; 1000]
所以下界是
lwb = range(-200,1000,50)
和上限是
upb = range(-150,1050,50)
我现在不知道如何获取频率(每个间隔内的值的数量)...我确定没有必要定义lwb和upb ...但是我不知道应该使用什么函数执行这个!(在学习了Pandas doc之后,我认为cut
函数可以为我提供帮助,因为这是一个离散化问题...但是我不知道如何使用它)
能够做到这一点之后,我将看看显示直方图的方式(但这是另一个问题)