# ---
# 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="pu_iar2hlXpo" colab_type="code" colab={}
import pandas as pd
import numpy as np
import matplotlib as pls
import seaborn as sns

# + id="9xG-RUwel5_K" colab_type="code" outputId="466b9222-a0b9-4ecf-8fa9-6e383a78af01" executionInfo={"status": "ok", "timestamp": 1583246370575, "user_tz": -60, "elapsed": 590, "user": {"displayName": "<NAME>\u0105kowski", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 35}
# cd '/content/drive/My Drive/Colab Notebooks/DataScienceMatrix/Matrix_two/DataScienceMatrix2'

# + id="5VY9uWO4mMu5" colab_type="code" outputId="29c2e769-def6-473f-9095-06358bccacc6" executionInfo={"status": "ok", "timestamp": 1583246375312, "user_tz": -60, "elapsed": 4277, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 72}
# !pip install --upgrade tables

# + id="mdTLFKocmNWu" colab_type="code" outputId="14391272-175f-4119-eb7a-d25df1a35203" executionInfo={"status": "ok", "timestamp": 1583246377219, "user_tz": -60, "elapsed": 5209, "user": {"displayName": "<NAME>0105kowski", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 35}
df = pd.read_hdf('Data/car.h5')
df.shape

# + id="RJsIY5MgmbPv" colab_type="code" outputId="7a69fd6c-1ec4-4a38-b90f-13e61fa54c38" executionInfo={"status": "ok", "timestamp": 1583246377220, "user_tz": -60, "elapsed": 3856, "user": {"displayName": "<NAME>0105kowski", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 1000}
df.columns.values

# + id="fIEIEmevntku" colab_type="code" outputId="7149bccc-ac1f-482b-c871-573a419e7fe4" executionInfo={"status": "ok", "timestamp": 1583246377504, "user_tz": -60, "elapsed": 2722, "user": {"displayName": "<NAME>0105kowski", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 283}
df['price_value'].hist(bins = 100)

# + id="4LrGdbHqoRV7" colab_type="code" outputId="cd404298-042d-445f-894f-24a6091c4bb1" executionInfo={"status": "ok", "timestamp": 1583246377506, "user_tz": -60, "elapsed": 400, "user": {"displayName": "<NAME>0105kowski", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 182}
df['price_value'].describe()


# + id="-rSnKFekoih_" 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="7hDAm-17pHnU" colab_type="code" outputId="115100ff-b9a8-4b68-8498-3a3a1061b1ca" executionInfo={"status": "ok", "timestamp": 1583247432451, "user_tz": -60, "elapsed": 1429, "user": {"displayName": "<NAME>0105kowski", "photoUrl": "https://lh3.googleusercontent.com/a-/AOh14GgHseLPzBOkIXaO0lELM-ezk_as0z1lKff-kfBOpA=s64", "userId": "13332086424158705370"}} colab={"base_uri": "https://localhost:8080/", "height": 365}
group_and_barplot('param_year');

# + id="fk3wlpB31qCX" colab_type="code" colab={}


StarcoderdataJupyterScriptsDedupFiltered