Home > Net >  Python script to check csv columns for empty cells that will be used with multiple excels
Python script to check csv columns for empty cells that will be used with multiple excels

Time:07-16

I've done research and can't find anything that has solved my issue. I need a python script to read csv files using a folder path. This script needs to check for empty cells within a column and then display a popup statement notifying users of the empty cells. Anything helps!!

CodePudding user response:

Use the pandas library pip install pandas

You can import the excel file as a DataFrame and check each cell with loops.

CodePudding user response:

Hello I think it's quite easy to solve with pandas:

import pandas as pd 
df = pd.readcsv('<path>')
df.describe() # to  just see empoty stuff 
np.where(pd.isnull(df)) # to show indexes of empty celss -> from https://stackoverflow.com/questions/27159189/find-empty-or-nan-entry-in-pandas-dataframe

alternatively you can read the file and check line by line for empty cells

  • Related