isalpha() function in pandas -Check for Alphabetic character of dataframe in python

isalpha() function in pandas is used to check for the presence of alphabetic character in a column of dataframe in python. Let’s see an example of isalpha() function in pandas.

Create a dataframe

##create dataframe

import pandas as pd
d = {'Quarters' : ['quarterone','quarter2','quarter3','quarter4'],
'Revenue':[23400344.567,54363744.678,56789117.456,4132454.987]}
df=pd.DataFrame(d)
print df

The resultant dataframe will be

alphabetic character in a column of dataframe in python 1

 

Check for alphabetic in column of dataframe in python

# whether alphabetic values present in Quarters column of dataframe in Python

df['Quarters_isalphabetic'] = map(lambda x: x.isalpha(), df['Quarters'])
print df

isalpha() Function in pandas python checks whether the string consists of alphabetic characters.

It returns True when alphabetic value is present and it returns False when the alphabetic value is not present.

The result is stored in the Quarters_isalphabetic column of the dataframe.

So the resultant dataframe will be

alphabetic character in a column of dataframe in python 2

previous isalpha() function in pandas -Check for Alphabetic character of dataframe in python                                                                                                                next isalpha() function in pandas -Check for Alphabetic character of dataframe in python