Answers for "change value of one column based on another column"

SQL
2

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

update one column from another column in same table

select * from stuff

update stuff
set TYPE1 = TYPE2
where TYPE1 is null;

update stuff
set TYPE1 = TYPE2
where TYPE1 ='Blank';

select * from stuff
Posted by: Guest on August-29-2021

Code answers related to "change value of one column based on another column"

Code answers related to "SQL"

Browse Popular Code Answers by Language