Search
 
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
Name
3+4 =