Answers for "pandas count empty string values"

0

pandas count empty string values

import pandas as pd, numpy as np

df = pd.DataFrame({'currency':['USD','','EUR','']})

(df['currency'].values == '').sum()           # 2

len(df[df['currency'] == ''])                 # 2

df.loc[df['currency'] == ''].count().iloc[0]  # 2
Posted by: Guest on June-14-2021

Python Answers by Framework

Browse Popular Code Answers by Language