I am trying to fetch xls file which contains empty cells. I need to validate the xls file using pandas to get row and column position
Expected output:
The row 2, col 2 has empty value [OR] Tenant ID is not found for Account1
Try this to obtain a list of Account Names with no Tenant Id:
res = df.loc[df['Tenant ID'].isnull(), 'Account Name'].tolist()
Alternatively, to filter your dataframe for rows where Tenant Id is empty:
df = df.loc[df['Tenant ID'].isnull(), :]
Explanation
.loc
accessor lets you specify row and column by Boolean arrays or label.pd.Series.isnull
to identify rows where Tenant Id is blank.pd.Series.tolist
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With