Changing the Case of String Columns in a Pandas DataFrame
Python
Data Preprocessing
In this example we convert the Name column within the df dataframe to upper case, lower case, title case (where the first letter of each word is uppercase) and finally we capitalise the string (make only the first letter of the entire string uppercase).
1| # uppercase 2| df['Name'] = df['Name'].str.upper() 3| 4| # lowercase 5| df['Name'] = df['Name'].str.lower() 6| 7| # titlecase (where the first letter of each word is uppercase) 8| df['Name'] = df['Name'].str.title() 9| 10| # capitalize (make only the first letter of the entire string uppercase) 11| df['Name'] = df['Name'].str.capitalize()
4
4
3
3
2
How to Remove Punctuation From Text with Python
Python
Data Preprocessing
Nlp | String | Punctuation
2
2
How to Create Different Aggregations Using GroupBy, Agg & Dictionaries
Python
Data Preprocessing
2
2
2