#qcut

cut qcut

factors=np.random.randn(30)In[11]:pd.cut(factors,5)Out[11]:[(-0.411,0.575],(-0.411,0.575],(-0.411,0.575],(-0.411,0.575],(0.575,1.561],...,(-0.411,0.575],(-1.397...
代码星球 ·2021-02-23

pandas的qcut()方法

pandas的qcut可以把一组数字按大小区间进行分区,比如data=pd.Series([0,8,1,5,3,7,2,6,10,4,9])比如我要把这组数据分成两部分,一半大的,一半小的,如果是小的数,值就变成'smallnumber',大的数,值就变成'largenumber':print(pd.qcut(data...
代码星球 ·2020-05-24