Input − Assume, you have a Series,
a abc b 123 c xyz d ijk
Solution
To solve this, we will follow the steps given below −
Define a Series
Get the index from user
Set the if condition to check the value is digit or not. It is defined below,
if(data[x].isdigit()):
print("digits present")
else:
print("not present")Example
Let us see the following implementation to get a better understanding.
import pandas as pd
dic = {'a':'abc','b':'123','c':'xyz','d':'ijk'}
data = pd.Series(dic)
x = input("enter the index : ")
if(data[x].isdigit()):
print("digits present")
else:
print("not present")Output
enter the index : a not present enter the index : b digits present