Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

setting price variable in 3 categories python

item_sale_avg['Price Category'] = np.where(item_sale_avg.Sales <= 500, 'low', 
                                  np.where(item_sale_avg.Sales >= 1500, 'high', 'medium'))

print (item_sale_avg)
   Sales Price Category
0    100            low
1    500            low
2    600         medium
3   1500           high
4   2000           high
Comment

PREVIOUS NEXT
Code Example
Python :: grading system in python with nested if 
Python :: anagram game 
Python :: tuple with only one element in Python 
Python :: run exe for python and wait until finish 
Python :: kivy lang 
Python :: Herons rule python 
Python :: import nifti to numpy 
Python :: python plot auc 95% confidence intervals stackoverflow 
Python :: adding text on barplot using seabron 
Python :: how to check for non-datetime value in python 
Python :: function continuity python 
Python :: the entire bee movie script but backwards 
Python :: colorama input python 
Python :: check if a date is reached django 
Python :: initialize boolean list of size python 
Python :: fromhex python 2.7 
Python :: find no of iterations in python 
Python :: crop image using opencv with height and width 
Python :: pip install matplotlib.pyplot 
Python :: max sum slice python 5 - autopilot 
Python :: python crear variables 
Python :: print hello in python 
Python :: simple example of printing a C version of a SymPy expression: 
Python :: Creating sub elements in xml in python with ElementTree 
Python :: python unsigned to signed integer 
Python :: inverting a dictionary 
Python :: python string index 
Python :: shuffle function in python 
Python :: list arguments of function python 
Python :: install python 3.7 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =