Answers for "replace column value with another column in different table"

3

change column value based on another column pandas

# Changes the 'is_electric' column based on value in the 'type' column
# If the 'type' column == 'electric' then the 'is_electric' becomes 'YES'
df['is_electric']= df['type'].apply(lambda x: 'YES' if (x == 'electric') else 'NO')
Posted by: Guest on November-19-2020
0

column.replace

df.column = df.coloumn.replace('old_value', 'new_value')
Posted by: Guest on January-26-2021

Code answers related to "replace column value with another column in different table"

Python Answers by Framework

Browse Popular Code Answers by Language