Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas set column to value using mask

df['Event'] = np.where((df.Event == 'Painting'),'Art',df.Event)
df
Comment

PREVIOUS NEXT
Code Example
Python :: pandas converters example 
Python :: Adding new fields in ModelAdmin with fieldsets to edit user, and add_fieldsets whan creating a new user 
Python :: how to convert a sentence into a list of words in python 
Python :: write in file python 
Python :: operation that returns True if all values are equal 
Python :: plot every nth label in barplot 
Python :: pytho ntoday as string 
Python :: convert pb to tb with python 
Python :: python counter infinite series 
Python :: get size of square matrix python 
Python :: python getattr function 
Python :: <ipython-input-31-da456dc89cda in <module 
Python :: get length of a tuple in python 
Python :: tkinter sin 
Python :: ValueError: Could not load "" Reason: "broken data stream when reading image file" 
Python :: reload module 
Python :: python generate sine wave pyaudio 
Python :: count each value in lsitp ython 
Python :: train_ttest_split() 
Python :: qaction disacble python 
Python :: keep calm and carry on memes 
Python :: wexpect in python 
Python :: c to python translator 
Python :: df add column from dict 
Python :: pandas first row to header 
Python :: pandas add time to datetime 
Python :: import one hot encoder 
Python :: size of matrix python 
Python :: divide list into equal parts python 
Python :: store message sent by user in string discord py 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =