0

I am sorry if this question has already been answered. In my code, I create a new column in my dataframe ("PaymentIdentificationEnd") by changing one letter in the data of the column ("PaymentIdentification").

The line code is :

dataframe['PaymentIdentificationEnd'] = dataframe['PaymentIdentification'].apply(lambda x : x[:-2] + "E" + x[-1])

An example of data in the column ("PaymentIdentification") : MCRM-QRR-20210226-120000-02PI1I1

My code works but I have few warnings like this one, how can I remove it ?

SettingWithCopyWarning: 
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  dataframe['PaymentIdentificationEnd'] = dataframe['PaymentIdentification'].apply(lambda x : x[:-2] + "E" + x[-1])

Thank you

Ismael Padilla
  • 5,246
  • 4
  • 23
  • 35
Maikiii
  • 421
  • 4
  • 13

0 Answers0