Skip to main content

Handle Missing Data By Either Dropping Rows/Columns, Forward/Backward Filling or Imputing with Mean, Median or Mode

Project description

Library for Handling Missing Data

PROJECT 3, UCS633 - Data Analysis and Visualization
Navkiran Singh  
Roll number: 101703365

Takes two inputs - filename of input csv, intended filename of output csv.

Two optional arguments - which must be provided together or left out.

Resulting csv is saved with the name you provide.


pip install missing_data_navkiran

Recommended - test in a virtual environment.

Use via command line

Defaults are drop NaN with parameter along = 0 (drops rows containing NaN)

missing_data_navkiran_cli in.csv out.csv

Drop rows with NaN missing_data_navkiran_cli in.csv out.csv DROP 0

Drop columns with NaN missing_data_navkiran_cli in.csv out.csv DROP 1

Forward filling missing_data_navkiran_cli in.csv out.csv FILL 0

Backward filling missing_data_navkiran_cli in.csv out.csv FILL 1

Imputing with mean missing_data_navkiran_cli in.csv out.csv IMPUTE 0

Imputing with median missing_data_navkiran_cli in.csv out.csv IMPUTE 1

Imputing with mode missing_data_navkiran_cli in.csv out.csv IMPUTE 2

First argument after outcli is the input csv filename from which the dataset is extracted. The second argument is for storing the final dataset after processing.

Use in .py script

from missing_data_navkiran import dropval,filler,impute
input_df = pd.read_csv('in.csv')
output_df = dropval(input_df,along=0)
# Or
output_df = filler(input_df,1)
# Or
output_df = impute(input_df,1)

There are also stand alone functions to fill numerical data and fill categorical data.

from missing_data_navkiran import fill_numerical,fill_categorical

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

missing_data_navkiran-1.0.0.tar.gz (3.0 kB view hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page