Analyzing a real world data is some what difficult because we need to take various things into consideration. Apart from getting the useful data from large datasets, keeping data in required format is also very important.
One might encounter a situation where we need to uppercase each letter in any specific column in given dataframe. Let’s see how can we Apply uppercase to a column in Pandas dataframe.
Let’s create a dataframe using nba.csv
.
import pandas as pd
data_top = data.head( 10 )
data_top
|
Output:

There are certain methods we can change/modify the case of column in Pandas dataframe. Let’s see how can we apply uppercase to a column in Pandas dataframe using upper()
method.
Method #1:
import pandas as pd
data[ 'Name' ] = data[ 'Name' ]. str .upper()
data.head()
|
Output:

Method #2: Using lambda with upper()
method
import pandas as pd
data.dropna(inplace = True )
data[ 'College' ]. apply ( lambda x: x.upper()).head( 10 )
|
Output:

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
06 Dec, 2018
Like Article
Save Article