Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

binning dat adataframe

# Splitting Age Column into Four Quantiles
df['Age Groups'] = pd.qcut(df['Age'], 4)
print(df.head())

# Returns:
#      Name  Age     Age Groups
# 0     Ray   12  (6.999, 17.0]
# 1    Jane    7  (6.999, 17.0]
# 2    Kate   33   (17.0, 33.5]
# 3     Nik   34   (33.5, 52.5]
# 4  Autumn   45   (33.5, 52.5]
Comment

PREVIOUS NEXT
Code Example
Python :: onlt int validator qt py 
Python :: how to loop over day name in python 
Python :: edit line if str end with pandas 
Python :: somma in python 
Python :: guido van rossum net worth 
Python :: django templateview 
Python :: user input dictionary python 
Python :: how to write in google chrome console in python 
Python :: load all csv files in a folder python pandas 
Python :: how to reverse word order in python 
Python :: csv python write 
Python :: python get home path 
Python :: python memoization 
Python :: browser pop up yes no selenium python 
Python :: python read text file into a list 
Python :: df order by 
Python :: python custom array sort 
Python :: python number of elements in multidimensional array 
Python :: How to ungrid something tkinter 
Python :: hot to pay music in pygame 
Python :: python split a string by tab 
Python :: is root node an internal node 
Python :: python tkinter filedialog 
Python :: how to add card using py-trello API 
Python :: random variables python 
Python :: tkinter bold text 
Python :: python launch file 
Python :: how to convert list into string in python 
Python :: combinations python 
Python :: find all unique items in dictionary value python 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =