1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Plotting missing values - python

Discussão em 'Python' iniciado por Stack, Outubro 6, 2024.

  1. Stack

    Stack Membro Participativo

    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    import seaborn as sns
    from pylab import rcParams
    import missingno as msno
    import warnings # Ignores any warning
    rcParams['figure.figsize'] = 12, 5
    pd.set_option('display.max_rows', None)
    pd.set_option('display.max_columns', None)
    pd.set_option ('display.large_repr', 'truncate')
    pd.set_option ('display.max_colwidth', 30)

    #Here the first rows of the dataset which includes the unwanted headers are removed.
    train = pd.read_csv(r"C:\\Users\\data analysis\\sales data correct .csv", header = 6)
    #If the country is empty such rows are omitted.
    unwantedrows = train.dropna (subset = ["Country"], inplace = True)
    print (train.head(5))
    #to plot
    msno.matrix(train)
    plt.show()


    I have a large dataset with missing values. To find the pattern of missing values I am trying to visualize them according to the column values. The dataset contains quality, country and a couple of years. It is about sales occurred during these years.

    Manually it can be identified that missing values are because the company has not introduced themselves to those countries in the missing years.

    How to find this visually using any python libraries?

    What I need is in Y axis the Quality column values (Standard, premium) to be displayed and x axis contains the rest of columns including quality.

    Quality Country 1994 1995 1996
    Standard USA 123 345 789
    Standard UK NA 45 78
    Standard Europe NA NA 56
    Premium USA 56 67 56
    Premium UK NA 45 24

    Sample of what I need

    Tried using msno.matrix. But it does not state the column values.

    Continue reading...

Compartilhe esta Página