Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas bin columns

bin_edges = [3, 5, 7, 9, 11]
bin_names = ["Low" , "Medium", "Moderately high", "High"]
df["new_column"] = pd.cut(df["column"], bin_edges, labels=bin_names)
Comment

PREVIOUS NEXT
Code Example
Python :: python parcourir un dictionnaire 
Python :: how to create model in tensorflow 
Python :: drop duplicate index pandas 
Python :: python-telegram-bot 
Python :: get month day year 12 hour time format python 
Python :: plot second y axis matplotlib 
Python :: how to read a csv file in python 
Python :: django ModelChoiceField value not id 
Python :: how to open a website using python 
Python :: multiple pdf in a directory to csv python 
Python :: get name of variable python 
Python :: concat all df in a diction 
Python :: python import file from parent directory 
Python :: System.Windows.Forms.DataGridView.CurrentRow.get returned null. c# 
Python :: Python program to draw star 
Python :: linspace python 
Python :: remove last line of text file python 
Python :: how to make an infinite loop python 
Python :: python read text file next line 
Python :: python recursively print directory 
Python :: redis json python 
Python :: arrange array in ascending order python 
Python :: best python ide for ubuntu 
Python :: python timedelta to seconds 
Python :: pandas select rows by multiple conditions 
Python :: python copy 
Python :: python functions 
Python :: tensorflow adam 
Python :: reshape wide to long in pandas 
Python :: python mode 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =