# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + id="Lp_SnnVpFj_W" colab_type="code" colab={}
import os

# !pip install --upgrade tables
# !pip install eli5

os.kill(os.getpid(), 9)

# + id="uok6tUw1TmvG" colab_type="code" colab={}
from google.colab import drive
ROOT_DIR = "/content/drive"
drive.mount(ROOT_DIR)

# + id="CTGQJeljEDnB" colab_type="code" colab={}
MATRIX_TWO_PATH = ROOT_DIR + "/My Drive/Colab Notebooks/matrix/matrix_two"

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# + id="s1hlyGQBTuDw" colab_type="code" colab={}
# cd "{MATRIX_TWO_PATH}/dw_matrix_cars/"

# + id="FfLhwxgcGlMZ" colab_type="code" colab={}
df = pd.read_hdf('data/car.h5')


# + id="uKdG8nAGJeHG" colab_type="code" colab={}
def group_and_barplot(feat_groupby, feat_agg='price_value', agg_funcs=[np.mean, np.median, np.size], feat_sort='mean', top=50, subplots=True):
  return(
      df
        .groupby(feat_groupby)[feat_agg]
        .agg(agg_funcs)
        .sort_values(by=feat_sort, ascending=False)
        .head(top)
  ).plot(kind='bar', figsize=(15,5), subplots=subplots)


# + id="QCrAKfF_WJKN" colab_type="code" colab={}
df.columns.values

# + id="X1S0ngbxVyw4" colab_type="code" colab={}
group_and_barplot('param_year');

StarcoderdataJupyterScriptsDedupFiltered