I'm trying to overwrite a new column within a DataFrame based on a conditional expression:
-
if df['service'] == 'PE1' or 'PE2': -
Change the existing value in df['service'] to equal the original df['service'] + df['load port'].
# if ['load port] == 'ABC' then new value == PE1ABC -
else: keep the original value in df['service']
# in other words != 'PE1' or 'PE2'.
I'm trying to use the .merge() to "VLOOKUP" from another DataFrame. However, the 'PE1' and 'PE2' services require the load port. All other services have a 1:1 assignment.
Aucun commentaire:
Enregistrer un commentaire