Check whether only the lower case is present in a given column of a DataFrame

In this python pandas program, we will check whether only the lower case is present in a given column of a DataFrame using the pandas library.

Steps to solve the program
  1. Import pandas library as pd.
  2. Create a dataframe using pd.DataFrame().
  3. Check whether only the lowercase is present in a column of a DataFrame using df[‘Lowerercase’] = list(map(lambda x: x.islower(), df[‘Name’])).
  4. It will create a new column in the dataframe that will contain True if the value in the name row contains all the lowercase characters or else False.
  5. The lambda function will check whether the value in the name column contains all the lowercase characters or not
  6. list() will create a list of all results after applying the lambda function to each value.
  7. Print the output.
				
					import pandas as pd
d = {'Name':['kate','jason','ROBERT','MARK','dwyane']}
df = pd.DataFrame(d)
df['Lowerrcase'] = list(map(lambda x: x.islower(), df['Name']))
print(df)
				
			

Output :

				
					0     Name  Lowerrcase
0    kate        True
1   jason        True
2  ROBERT       False
3    MARK       False
4  dwyane        True
				
			

check whether only the upper case is present in a column of a DataFrame

check whether only numeric values are present in a column of a DataFrame

Leave a Comment