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
- Import pandas library as pd.
- Create a dataframe using pd.DataFrame().
- Check whether only the lowercase is present in a column of a DataFrame using df[‘Lowerercase’] = list(map(lambda x: x.islower(), df[‘Name’])).
- 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.
- The lambda function will check whether the value in the name column contains all the lowercase characters or not
- list() will create a list of all results after applying the lambda function to each value.
- 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