DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
replace column values/create new column based on another column values/condition in Pandas
df['New Column'] = np.where(df['A']==0, df['B'], df['A'])
Source by stackoverflow.com #
PREVIOUS
NEXT
Tagged:
#replace
#column
#column
#based
#column
#Pandas
ADD COMMENT
Topic
COMMENT
Name
6+1 =
Submit