Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

difference between cut and qcut pandas

pd.cut(df['ext price'], bins=4).value_counts() #bin range size afre equal

#res
(87998.212, 120263.375]     12 #different no. of observation
(55603.989, 87998.212]       5
(120263.375, 152528.538]     2
(152528.538, 184793.7]       1
Name: ext price, dtype: int64

#If you want equal distribution of the items in your bins, use qcut . If you want to define your own numeric bin ranges, then use cut .
Source by pbpython.com #
 
PREVIOUS NEXT
Tagged: #difference #cut #qcut #pandas
ADD COMMENT
Topic
Name
1+3 =