Pie Graph of Data Types



    Wyx Smrf

    Creates a pie graph from the data types generated in a pandas DataFrame.

    Library: Pandas

    Shortcut: Pie

    Filename pattern: .ipynb, .py

    import numpy as np
    import pandas as pd
    import matplotlib.pyplot as plt
    dtypes_graph_params = {'data': df,
                'title': 'Data Types', 
                'title_location': 'center'}
    def dtypes_graph(data, title, title_location):
      dtype_count  = data.dtypes.value_counts()
      dtype_name_list = dtype_count.index.tolist()
      plt.pie(dtype_count, labels=dtype_name_list, autopct='%.1f%%')
      plt.title(title, loc=title_location)
      return plt.show()
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.