I have Df like this
Name PAN
0 x BBDFW7894Q
1 s
2 A QWE7892E
i want df like this After validation PAN number
Name PAN PAN_Status
0 x BBDFW7894Q Valid PAN number
1 s PAN is not present
2 A QWE7892E Invalid PAN number
i trying with below logic
df["PAN_Status"] = ["Valid PAN number" if re.match(r'^[A-Z]{5}[0-9]{4}[A-Z]$',ele)\
else ("PAN is not present"if ele==' ' else "Not Valid PAN") for ele in
but i want a Function for this