Avatar of Sean Girgis
Sean Girgis
Flag for United States of America

asked on 

Python - Pandas - DataFrame- update a column from another based on compare

#Python3.78 #Pandas #DataFrame

I have a dataframe servers.csv

I want to update rating1 from rating2 as follows: -

rating1 will be equal to rating2 when rating2 > rating1

servers.csv

outcome.csv



servers.csv file

------------

Server, rating1 , rating2
'Serv1' , 500.54,
'Serv2' , , 750.21
'Serv3' , 500, 750.35
'Serv4' , 999.99, 399


outcome.csv file
------------
Server, rating1 , rating2
'Serv1' , 500.54,
'Serv2' , 750.21 , 750.21
'Serv3' , 750.35, 750.35
'Serv4' , 999.99, 399

Python* pandas* Datascience

Avatar of undefined
Last Comment
David H.H.Lee

8/22/2022 - Mon