Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

bucket dataframe into ranges

def conditions(i): 
    if i <=50: return '0-50'
    if i > 50 and i <=100: return '50-100'
    if i > 100 and i <=250: return '100-250'
    if i > 250 and i <=350: return '250-350'
    if i > 350: return '>350'

df['C']=df['B'].apply(conditions)
Comment

PREVIOUS NEXT
Code Example
Python :: combination generator python 
Python :: pandas set a value in colmns as the maximum value 
Python :: discord.py find user by name 
Python :: append to a ldictionary value list 
Python :: what is a good django orm cookbook 
Python :: how to get tomorrow date in python 
Python :: choose custom index pandas 
Python :: how to get the access of python on cmd 
Python :: PILImage.py", line 2975, in open fp = builtins.open(filename, "rb") PermissionError: [Errno 13] Permission denied: 
Python :: python random number generator 
Python :: php echo shorthand example 
Python :: how to get coupons from honey in python 
Python :: sklearn kmeans mnist 
Python :: oop - Apa metaclasses di Python 
Python :: how to fetch only the columns from a datframe which has a particular datatype 
Python :: aritmetics to a value in a dict python 
Python :: send command civil3D 
Python :: [Solved] Pandas TypeError: no numeric data to plot 
Python :: python to open .seg file 
Python :: python code to save data with multiple sheet in excel 
Python :: setting price variable in 3 categories python 
Python :: flask Upload file to local s3 
Python :: get the value of qpushbutton pyqt5 with argument 
Python :: wx.SingleInstanceCheckerindexmodules 
Python :: arm str example 
Python :: inverted trapezium pattern in python 
Python :: how to set conditionlally keys in python 
Python :: openpyxl iter_rows skip first 
Python :: paystack python 
Python :: python file write all the bounding box coordinates using opencv 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =