I am trying to apply lambda with if-else condition on a pandas df df looks like following:
col1 col2 col3 col4 <---column names
None None None col4 <---column values in str
col1 None None None
None col2 None None
df_twitter_archive_master[['col1','col2','col3','col4']].apply(lambda x: x=0 if x=='None' else x=1)
basically, it should replace 'None' value with 0 and else with 1 but I keep getting this error
df_twitter_archive_master[['col1','col2','col3','col4']].apply(lambda x: x=0 if x=='None' else x=1)
SyntaxError: invalid syntax
^ is under x=1
what am i doing wrong? ?