Missing data visualization module for Python.

Overview

missingno PyPi version t

Messy datasets? Missing values? missingno provides a small toolset of flexible and easy-to-use missing data visualizations and utilities that allows you to get a quick visual summary of the completeness (or lack thereof) of your dataset. Just pip install missingno to get started.

Quickstart Binder

This quickstart uses a sample of the NYPD Motor Vehicle Collisions Dataset dataset. To get the data yourself, run the following on your command line:

$ pip install quilt
$ quilt install ResidentMario/missingno_data

Then to load the data into memory:

>>> from quilt.data.ResidentMario import missingno_data
>>> collisions = missingno_data.nyc_collision_factors()
>>> collisions = collisions.replace("nan", np.nan)

The rest of this walkthrough will draw from this collisions dataset. I additionally define nullity to mean whether a particular variable is filled in or not.

Matrix

The msno.matrix nullity matrix is a data-dense display which lets you quickly visually pick out patterns in data completion.

>>> import missingno as msno
>>> %matplotlib inline
>>> msno.matrix(collisions.sample(250))

alt text

At a glance, date, time, the distribution of injuries, and the contribution factor of the first vehicle appear to be completely populated, while geographic information seems mostly complete, but spottier.

The sparkline at right summarizes the general shape of the data completeness and points out the rows with the maximum and minimum nullity in the dataset.

This visualization will comfortably accommodate up to 50 labelled variables. Past that range labels begin to overlap or become unreadable, and by default large displays omit them.

If you are working with time-series data, you can specify a periodicity using the freq keyword parameter:

>>> null_pattern = (np.random.random(1000).reshape((50, 20)) > 0.5).astype(bool)
>>> null_pattern = pd.DataFrame(null_pattern).replace({False: None})
>>> msno.matrix(null_pattern.set_index(pd.period_range('1/1/2011', '2/1/2015', freq='M')) , freq='BQ')

alt text

Bar Chart

msno.bar is a simple visualization of nullity by column:

>>> msno.bar(collisions.sample(1000))

alt text

You can switch to a logarithmic scale by specifying log=True. bar provides the same information as matrix, but in a simpler format.

Heatmap

The missingno correlation heatmap measures nullity correlation: how strongly the presence or absence of one variable affects the presence of another:

>>> msno.heatmap(collisions)

alt text

In this example, it seems that reports which are filed with an OFF STREET NAME variable are less likely to have complete geographic data.

Nullity correlation ranges from -1 (if one variable appears the other definitely does not) to 0 (variables appearing or not appearing have no effect on one another) to 1 (if one variable appears the other definitely also does).

Variables that are always full or always empty have no meaningful correlation, and so are silently removed from the visualization—in this case for instance the datetime and injury number columns, which are completely filled, are not included.

Entries marked <1 or >-1 have a correlation that is close to being exactingly negative or positive, but is still not quite perfectly so. This points to a small number of records in the dataset which are erroneous. For example, in this dataset the correlation between VEHICLE CODE TYPE 3 and CONTRIBUTING FACTOR VEHICLE 3 is <1, indicating that, contrary to our expectation, there are a few records which have one or the other, but not both. These cases will require special attention.

The heatmap works great for picking out data completeness relationships between variable pairs, but its explanatory power is limited when it comes to larger relationships and it has no particular support for extremely large datasets.

Dendrogram

The dendrogram allows you to more fully correlate variable completion, revealing trends deeper than the pairwise ones visible in the correlation heatmap:

>>> msno.dendrogram(collisions)

alt text

The dendrogram uses a hierarchical clustering algorithm (courtesy of scipy) to bin variables against one another by their nullity correlation (measured in terms of binary distance). At each step of the tree the variables are split up based on which combination minimizes the distance of the remaining clusters. The more monotone the set of variables, the closer their total distance is to zero, and the closer their average distance (the y-axis) is to zero.

To interpret this graph, read it from a top-down perspective. Cluster leaves which linked together at a distance of zero fully predict one another's presence—one variable might always be empty when another is filled, or they might always both be filled or both empty, and so on. In this specific example the dendrogram glues together the variables which are required and therefore present in every record.

Cluster leaves which split close to zero, but not at it, predict one another very well, but still imperfectly. If your own interpretation of the dataset is that these columns actually are or ought to be match each other in nullity (for example, as CONTRIBUTING FACTOR VEHICLE 2 and VEHICLE TYPE CODE 2 ought to), then the height of the cluster leaf tells you, in absolute terms, how often the records are "mismatched" or incorrectly filed—that is, how many values you would have to fill in or drop, if you are so inclined.

As with matrix, only up to 50 labeled columns will comfortably display in this configuration. However the dendrogram more elegantly handles extremely large datasets by simply flipping to a horizontal configuration.

Configuration

For more advanced configuration details for your plots, refer to the CONFIGURATION.md file in this repository.

Contributing

For thoughts on features or bug reports see Issues. If you're interested in contributing to this library, see details on doing so in the CONTRIBUTING.md file in this repository.

Citation

You may cite this package using the following format (via this paper):

Bilogur, (2018). Missingno: a missing data visualization suite. Journal of Open Source Software, 3(22), 547, https://doi.org/10.21105/joss.00547

Comments
  • Histogram of data completeness by column

    Histogram of data completeness by column

    First, great package!

    The data completeness shows the completeness of the data over rows, I'm requesting a way to show the data completeness over the columns. Maybe a sparkline/histogram below the bottom row?

    ]

    enhancement 
    opened by jbwhit 9
  • Introduce orientation to bar plot

    Introduce orientation to bar plot

    The dendrogram has an option to change the orientation from top-down to left-right. This is convenient when having a large amount of columns. The bar plot misses this option. To make the bar plot effective for large numbers of columns, it should have a similar behaviour.

    This pull requests adds the basic functionality. The figsize is not yet adjusted, this should be added.

    opened by sbrugman 8
  • option for grouping the columns by similarity?

    option for grouping the columns by similarity?

    Hi, I like the idea of this package very much. Would it be much of a work to implement an automatic grouping of the features (and maybe subjects) based on similarity? this way one can see if the missing are random or there is some pattern...

    enhancement 
    opened by EnricoGiampieri 7
  • ValueError: The number of FixedLocator locations does not match the number of ticklabels

    ValueError: The number of FixedLocator locations does not match the number of ticklabels

    when I plot msno.bar(df_raw.sample(10)), it gives me a valuerror: "ValueError: The number of FixedLocator locations (0), usually from a call to set_ticks, does not match the number of ticklabels (186)"

    how can i fix this? fix the fixedLocator location? but how?

    bug 
    opened by ywsyws 6
  • Legend in heatmap

    Legend in heatmap

    I did a heatmap on the titanic dataset and it is a little hard to interpret. Some of the cells have numbers in them while others don't. I have no idea what the colors represent as there is no legend to interpret them.

    screen shot 2018-12-06 at 6 04 52 pm

    opened by mattharrison 6
  • subplotting

    subplotting

    What is the easiest way to have subplots of msno.matrix() for df1 , df2, df3 . I already checked this issue and didn't work due to TypeError 'AxesSubplot' object does not support indexing and updated pandas and missingno based on this issue. Please leave a general solution we can just by replacing different df we can use it. Have a nice evening

    opened by clevilll 5
  • Module not found error

    Module not found error

    I keep getting this error message on jupyter notebook while running python 3.6. I stopped the kernel and restarted to check, but it won't. And suggestions?


    ModuleNotFoundError Traceback (most recent call last) in () ----> 1 import missingno as msno 2 get_ipython().magic('matplotlib inline') 3 msno.matrix(collisions.sample(250))

    ModuleNotFoundError: No module named 'missingno'

    opened by vhkrish 5
  • Include smaller example data for users to follow along (and for future tests)

    Include smaller example data for users to follow along (and for future tests)

    This package is meant to tackle the visualization tasks of large data sets, and the provided examples are fantastic for demonstrating the utter complexity that users may face. I'm especially glad to see that you have posted examples of how you munged the data. This is quite valuable to fair-weather Python users such as myself. 👍

    However, in order to follow along, users must start by downloading all 1M+ rows (and growing!) of the NYPDMVC data set. 😿 My suggestion would be to include a small subset of these data in the package (I believe you can specify the location with package_data in your setup file).

    opened by zkamvar 4
  • Returning matplotlib.figure/axes?

    Returning matplotlib.figure/axes?

    Hi, For users who want to fiddle around with the produced plot, it would be helpful to return the matplotllib.figure/axis. My use case- I want to give a ylabel to the rows to use in a publication.

    enhancement 
    opened by nipunbatra 4
  • source-file for pypi?

    source-file for pypi?

    Hi the github source file does not compile with `python3 setup.py install '

    Could you please publish a source file on pypi.org that does? (I am not using the whl file)

    opened by brobr 3
  • error in matrix function at line 117 - caused by line 185

    error in matrix function at line 117 - caused by line 185

    If the dataset has timestamps starting from middle of the day or ending with middle of the day then trying to divide by Day or Hour causes error. Sending through a fix.

    opened by armando-fandango 3
  • MatplotlibDeprecationWarning - grid(b=False) -> grid(visible=False)

    MatplotlibDeprecationWarning - grid(b=False) -> grid(visible=False)

    Running pytest results in:

    MatplotlibDeprecationWarning: The 'b' parameter of grid() has been renamed 'visible' since Matplotlib 3.5; support for the old name will be dropped two minor releases later. ax0.grid(b=False)

    opened by r-leyshon 0
  • Installation issues in M1 Mac

    Installation issues in M1 Mac

    Tried installing with both pip as well as conda, both give the error. Here's the conda installation log (after uninstalling the previous installation with pip):

    (base) [email protected] ~ % conda install -c conda-forge missingno
    Collecting package metadata (current_repodata.json): done
    Solving environment: done
    
    ## Package Plan ##
    
      environment location: /Users/Admin/miniforge3
    
      added / updated specs:
        - missingno
    
    
    The following packages will be UPDATED:
    
      conda              pkgs/main::conda-22.9.0-py310hca03da5~ --> conda-forge::conda-22.9.0-py310hbe9552e_2 None
      missingno          conda-forge/label/cf201901::missingno~ --> conda-forge::missingno-0.4.2-py_1 None
    
    The following packages will be SUPERSEDED by a higher-priority channel:
    
      ca-certificates    pkgs/main::ca-certificates-2022.10.11~ --> conda-forge::ca-certificates-2022.9.24-h4653dfc_0 None
      certifi            pkgs/main/osx-arm64::certifi-2022.9.2~ --> conda-forge/noarch::certifi-2022.9.24-pyhd8ed1ab_0 None
      openssl              pkgs/main::openssl-1.1.1s-h1a28f6b_0 --> conda-forge::openssl-1.1.1s-h03a7124_0 None
    
    
    Proceed ([y]/n)? y
    
    Preparing transaction: done
    Verifying transaction: done
    Executing transaction: done
    Retrieving notices: ...working... done
    

    After successful installation, tried to import it in Python, get the following error:

    (base) [email protected] ~ % python
    Python 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:41:22) [Clang 13.0.1 ] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import missingno
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/missingno/__init__.py", line 1, in <module>
        from .missingno import matrix
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/missingno/missingno.py", line 5, in <module>
        from scipy.cluster import hierarchy
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/cluster/__init__.py", line 25, in <module>
        from . import vq, hierarchy
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/cluster/vq.py", line 72, in <module>
        from scipy.spatial.distance import cdist
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/spatial/__init__.py", line 105, in <module>
        from ._kdtree import *
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/spatial/_kdtree.py", line 5, in <module>
        from ._ckdtree import cKDTree, cKDTreeNode
      File "_ckdtree.pyx", line 10, in init scipy.spatial._ckdtree
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/__init__.py", line 283, in <module>
        from . import csgraph
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/csgraph/__init__.py", line 182, in <module>
        from ._laplacian import laplacian
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/csgraph/_laplacian.py", line 7, in <module>
        from scipy.sparse.linalg import LinearOperator
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/__init__.py", line 120, in <module>
        from ._isolve import *
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/__init__.py", line 4, in <module>
        from .iterative import *
      File "/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/iterative.py", line 9, in <module>
        from . import _iterative
    ImportError: dlopen(/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/_iterative.cpython-310-darwin.so, 0x0002): Library not loaded: @rpath/liblapack.3.dylib
      Referenced from: <493DBB2C-B84A-3E4F-972C-B015A509EDE6> /Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/_iterative.cpython-310-darwin.so
      Reason: tried: '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/../../../../../../liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/../../../../../../liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/[email protected]/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/../../../../../../liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/lib/python3.10/site-packages/scipy/sparse/linalg/_isolve/../../../../../../liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/Users/Admin/miniforge3/bin/../lib/liblapack.3.dylib' (no such file), '/usr/local/lib/liblapack.3.dylib' (no such file), '/usr/lib/liblapack.3.dylib' (no such file, not in dyld cache)
    >>> 
    
    opened by PrashantSaikia 0
  • Add a title to graphs

    Add a title to graphs

    It would be useful to have a parameter to add a title to the graphs. This need comes from using missigno in a for...in loop, where the graphs are shown at the end of the loop, displacing graphs from displays.

    opened by hydrastarmaster 0
  • remove freq option in matrix

    remove freq option in matrix

    I'm seeing all the issues related to this option. I'm having issues with KeyError('Could not divide time index into desired frequency.'). The solution is to just remove this option. The index is the user's responsibility and the library should take it as is.

    There should be a separate data structing step which would be followed by the viz.

    opened by majidaldo 1
  • Choose strftime format argument in mnso.matrix (when using freq argument)

    Choose strftime format argument in mnso.matrix (when using freq argument)

    When I use the matrix function with a frequency inferior to a day the y axis labels are all the same because their format is fixed to '%Y-%m-%d'. It would be better to have the format as an option in function argument

    ts_ticks = pd.date_range(df.index[0], df.index[-1],
                                         freq=freq).map(lambda t:
                                                        t.strftime('%Y-%m-%d'))
    

    become

    ts_ticks = pd.date_range(df.index[0], df.index[-1],
                                         freq=freq).map(lambda t:
                                                        t.strftime(format))
    
    enhancement 
    opened by Sinnaeve 1
Releases(0.5.1)
  • 0.5.1(Feb 27, 2022)

  • 0.5.0(Jul 4, 2021)

    This is a maintenance release of missingno. The primary user-facing change is that the long-deprecated geoplot method and inline parameter have been removed.

    Source code(tar.gz)
    Source code(zip)
  • 0.4.2(Jul 9, 2019)

    This incremental release adds a minor feature and deprecates certain outdated functionality.

    • An ax parameter has been added to all plot types. Pass a matplotlib Axes object to this parameter to add the plot to a subplots or gridspec object (see #83). Note that the matrix plot does not support the sparkline parameter in this configuration.
    • The behavior of the sort parameter has changed. It has been removed from dendrogram and geoplot, where it did not do anything. bar will now use the sort parameter to order its markers (previously it had no effect on the plot output). The behavior of the sort parameter on matrix is unchanged.
    • The inline parameter has been deprecated and will be removed in a future version of missingno.
    • The geoplot function has been deprecated and will be removed in a future version of missingno. To replicate this functionality, see this recipe in the geoplot package documentation.
    Source code(tar.gz)
    Source code(zip)
  • 0.3.1(Oct 25, 2016)

Owner
Aleksey Bilogur
Building tools for doing data science @spellml. {📊, 💻, 🛠️}. Previously: @quiltdata, @recursecenter, @Kaggle, @MODA-NYC.
Aleksey Bilogur
Generate visualizations of GitHub user and repository statistics using GitHub Actions.

GitHub Stats Visualization Generate visualizations of GitHub user and repository statistics using GitHub Actions. This project is currently a work-in-

JoelImgu 3 Dec 14, 2022
Official Matplotlib cheat sheets

Official Matplotlib cheat sheets

Matplotlib Developers 6.7k Jan 09, 2023
Simple Inkscape Scripting

Simple Inkscape Scripting Description In the Inkscape vector-drawing program, how would you go about drawing 100 diamonds, each with a random color an

Scott Pakin 140 Dec 27, 2022
ICS-Visualizer is an interactive Industrial Control Systems (ICS) network graph that contains up-to-date ICS metadata

ICS-Visualizer is an interactive Industrial Control Systems (ICS) network graph that contains up-to-date ICS metadata (Name, company, port, user manua

QeeqBox 2 Dec 13, 2021
This is a small program that prints a user friendly, visual representation, of your current bsp tree

bspcq, q for query A bspc analyzer (utility for bspwm) This is a small program that prints a user friendly, visual representation, of your current bsp

nedia 9 Apr 24, 2022
A Python library created to assist programmers with complex mathematical functions

libmaths was created not only as a learning experience for me, but as a way to make mathematical models in seconds for Python users using mat

Simple 73 Oct 02, 2022
termplotlib is a Python library for all your terminal plotting needs.

termplotlib termplotlib is a Python library for all your terminal plotting needs. It aims to work like matplotlib. Line plots For line plots, termplot

Nico Schlömer 553 Dec 30, 2022
Displaying plot of death rates from past years in Poland. Data source from these years is in readme

Average-Death-Rate Displaying plot of death rates from past years in Poland The goal collect the data from a CSV file count the ADR (Average Death Rat

Oliwier Szymański 0 Sep 12, 2021
Shaded 😎 quantile plots

shadyquant 😎 This python package allows you to quantile and plot lines where you have multiple samples, typically for visualizing uncertainty. Your d

Mehrad Ansari 13 Sep 29, 2022
Parallel t-SNE implementation with Python and Torch wrappers.

Multicore t-SNE This is a multicore modification of Barnes-Hut t-SNE by L. Van der Maaten with python and Torch CFFI-based wrappers. This code also wo

Dmitry Ulyanov 1.7k Jan 09, 2023
EPViz is a tool to aid researchers in developing, validating, and reporting their predictive modeling outputs.

EPViz (EEG Prediction Visualizer) EPViz is a tool to aid researchers in developing, validating, and reporting their predictive modeling outputs. A lig

Jeff 2 Oct 19, 2022
GUI for visualization and interactive editing of SMPL-family body models ie. SMPL, SMPL-X, MANO, FLAME.

Body Model Visualizer Introduction This is a simple Open3D-based GUI for SMPL-family body models. This GUI lets you play with the shape, expression, a

Muhammed Kocabas 207 Jan 01, 2023
A simple python script using Numpy and Matplotlib library to plot a Mohr's Circle when given a two-dimensional state of stress.

Mohr's Circle Calculator This is a really small personal project done for Department of Civil Engineering, Delhi Technological University (formerly, D

Agyeya Mishra 0 Jul 17, 2021
JSNAPY example: Validate NAT policies

JSNAPY example: Validate NAT policies Overview This example will show how to use JSNAPy to make sure the expected NAT policy matches are taking place.

Calvin Remsburg 1 Jan 07, 2022
finds grocery stores and stuff next to route (gpx)

Route-Report Route report is a command-line utility that can be used to locate points-of-interest near your planned route (gpx). The results are based

Clemens Mosig 5 Oct 10, 2022
Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax.

PyDexter Simple plotting for Python. Python wrapper for D3xter - render charts in the browser with simple Python syntax. Setup $ pip install PyDexter

D3xter 31 Mar 06, 2021
Seismic Waveform Inversion Toolbox-1.0

Seismic Waveform Inversion Toolbox (SWIT-1.0)

Haipeng Li 98 Dec 29, 2022
Small U-Net for vehicle detection

Small U-Net for vehicle detection Vivek Yadav, PhD Overview In this repository , we will go over using U-net for detecting vehicles in a video stream

Vivek Yadav 91 Nov 03, 2022
Print matplotlib colors

mplcolors Tired of searching "matplotlib colors" every week/day/hour? This simple script displays them all conveniently right in your terminal emulato

Brandon Barker 32 Dec 13, 2022
A program that analyzes data from inertia measurement units installed in aircraft and generates g-exceedance curves.

A program that analyzes data from inertia measurement units installed in aircraft and generates g-exceedance curves.

Pooya 1 Dec 02, 2021