Pandas Srt.lower() Not Working On Dataframe Column
I'm working with the Titanic dataset available from Kaggle. I have it in a dataframe and i want to change the case of the 'sex' column to lowercase. I'm using the following code im
Solution 1:
str.lower()
does not modify the existing column. It just returns a new Series with the lowercase transform applied. If you want to overwrite the original column, you need to assign the result back to it:
df['sex'] = df.sex.str.lower()
Post a Comment for "Pandas Srt.lower() Not Working On Dataframe Column"