isdigit() Function in pandas check for numeric digit of dataframe in python

isdigit() Function in pandas is used how to check for the presence of numeric digit in a column of dataframe in python. Let’s see an example of isdigit() function in pandas

Create a dataframe

##create dataframe

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

The resultant dataframe will be

numeric character in a column of dataframe in python 1

 

Check for numeric digit in column of dataframe in python

# whether only numeric value is present in Quarters column of dataframe in Python

df['Quarters_isdigit'] = map(lambda x: x.isdigit(), df['Quarters'])
print df

isdigit() Function in pandas python checks whether the string consists of numeric digit characters.

It returns True when only numeric digits are present and it returns False when it does not have only digits

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

So the resultant dataframe will be

numeric character in a column of dataframe in python 2

previous numeric character in a column of dataframe in python isdigit function in pandas                                                                                                            next numeric character in a column of dataframe in python isdigit function in pandas