I want to change all values in a column of my pandas df to uppercase. The values are strings containing both letters and numbers.
I used the code below:
df['Cd'] = df['Cd'].str.upper()
The job was performed, however, I got the warning below:
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
I then tried the code below:
df['Cd'] = df['Cd'].apply(lambda x: str(x).upper())
I still ran to the same warning.
Please advice. Thanks!