Analyzing real-world data is somewhat 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 capitalize any specific column in given dataframe. Let’s see how can we capitalize first letter of a column in Pandas dataframe.
Let’s create a dataframe from the dict of lists.
There are certain methods we can change/modify the case of column in pandas dataframe. Let’s see how can we capitalize first letter of columns using
Method #2: Using lambda with capitalize() method
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Convert given Pandas series into a dataframe with its index as another column on the dataframe
- Get column index from column name of a given Pandas DataFrame
- Create a Pandas DataFrame from a Numpy array and specify the index column and column headers
- Python | Pandas Series.str.capitalize()
- How to capitalize first character of string in Python
- Python program to capitalize the first and last character of each word in a string
- Create a DataFrame from a Numpy array and specify the index column and column headers
- Python | Pandas DataFrame.fillna() to replace Null values in dataframe
- Pandas Dataframe.to_numpy() - Convert dataframe to Numpy array
- How to get column names in Pandas dataframe
- Python | Change column names and row indexes in Pandas DataFrame
- Convert the column type from string to datetime format in Pandas dataframe
- Apply uppercase to a column in Pandas dataframe
- How to lowercase column names in Pandas dataframe
- Get unique values from a column in Pandas DataFrame
- Adding new column to existing DataFrame in Pandas
- Get n-smallest values from a particular column in Pandas DataFrame
- Get n-largest values from a particular column in Pandas DataFrame
- Split a text column into two columns in Pandas DataFrame
- Create a column using for loop in Pandas Dataframe
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.