0

I have dataframe df has column TX_order, when I tried to sum null values df.isnull().sum(axis=0) The output was TX_order has 0 null values, however it has blank values. How can I show it or calculate this blank values to can remove it.

As in example below the TX_order has blank values but doesn't appear in the output

df

A header TX_order
First
Second row
Second
Second row
Second
Ynjxsjmh
  • 28,441
  • 6
  • 34
  • 52

1 Answers1

1

Looks like you have empty strings, try to replace them before isnull/sum :

df.replace("", None).isnull().sum() # `axis=0` by default

Output :

A header    0
TX_order    3
dtype: int64

Input used :

df = pd.DataFrame(
    {"A header": ["First", "Second", "Second", "Second", "Second"],
     "TX_order": ["", "row", "", "row", ""]}
)
Timeless
  • 22,580
  • 4
  • 12
  • 30