Badfish - A missing data wrangling library in Python
Badfish introduces MissFrame, a wrapper over
DataFrame, to wrangle through and investigate missing data. It opens an easy to
use API to summarize and explore patterns in missingness.
Badfish provides methods which make it easy to investigate any systematic issues in data wrangling, surveys, ETL processes which can lead to missing data.
The API has been inspired by typical questions which arise when exploring missing data.
Badfish uses the
how api in most of its methods to prepare a subset of the data to work on.
where : Work on a subset of data
where specified columns are missing.
how : Either
any of the columns should be missing.
mf.counts(columns = ['Age', 'Gender']) would give counts of missing values in the entire dataset.
mf.counts(where=['Income'], columns = ['Age', 'Gender']) would give counts of missing values in subset of data where
Income is already missing.
pip install badfish
>>> import badfish as bf >>> mf = bf.MissFrame(df)
Will add an exmaple IPython notebook soon.
Basic counts of missing data per column.
>>> mf.counts(where=['gender', 'age'], how='all', columns=['Income', 'Marital Status'])
Get counts on different combinations of columns with missing data.
True means missing and
False means present.
The same can be visualized in the form of a plot (inspired by VIM package in R)
>>> mf.plot(kind='pattern') Example plot:
how can be used in this method.
Use frequency item set mining to find subgroups where data goes missing together. Note: This uses the PyMining package.
>>> itemsets, rules = mf.frequency_item_set()
Tries to find signigicant group differences between values of columns other than the ones specified in the group clause. Group
made on the basis of missing or non-missing of columns in the group clause. Internally uses
This method works on the values in each column instead of column names.
Note: Experimental method.
>>> mf.cohort(group=['gender'], columns=['Income'])
Please see the repository license.
Generally, we have licensed badfish to make it as widely usable as possible.
Call for contribution
If you have any ideas, issues or feature requests, feel free to open an issue, send a PR or contact us.