DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR PYTHON
pandas new column with loc
df.loc[(df['c1'] == 'Value'), 'c2'] = 10 df.loc[~(df['c1'] == 'Value'), 'c2'] = df['c3']
PREVIOUS
NEXT
Tagged:
#pandas
#column
#loc
ADD COMMENT
Topic
COMMENT
Name
1+3 =
Submit