Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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
Comment

PREVIOUS NEXT
Code Example
Python :: python try except finally 
Python :: at=error code=h10 desc= app crashed python flask 
Python :: python regular expression 
Python :: readlines replace  
Python :: calculate term frequency python 
Python :: python - how many letters are capital in a string 
Python :: python extract string 
Python :: python count of letters in string 
Python :: how to convert tuple into list in python 
Python :: Python "for in" loop to print the last item in the list 
Python :: beautifulsoup check if text exists 
Python :: python index max list 
Python :: check if list is empty python 
Python :: python get env 
Python :: squre value of a column pandas 
Python :: python file write 
Python :: pandas insert row 
Python :: How to calculate distance without numpy 
Python :: Pandas conditional collumn 
Python :: multiline comment in python 
Python :: get return value from transaction in brownie 
Python :: how to find a square root of a number using python 
Python :: pyjwt 
Python :: python requests-session for websites with login 
Python :: create dictionary 
Python :: polish notation python 
Python :: multiplication table python 
Python :: python create dataframe by row 
Python :: is vs == python 
Python :: video capture opencv and multiprocessing 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =