# ---
# 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="O2bvEtUEAFsg" colab_type="code" colab={}
# #!pip install datadotworld
# #!pip install datadotworld[pandas]

# + id="oCFBgKeUDg0O" colab_type="code" colab={}
# #!dw configure

# + id="02EYicaeCYV6" colab_type="code" colab={}
from google.colab import drive
import pandas as pd
import numpy as np 

import datadotworld as dw

# + id="g1t99ZzeHTua" colab_type="code" colab={}
#drive.mount("/content/drive")

# + id="dR-g5QQZHdnG" colab_type="code" outputId="d2af771f-941b-4adb-a182-7dcfdb234059" executionInfo={"status": "ok", "timestamp": 1581859629534, "user_tz": -60, "elapsed": 590, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 51}
# cd "drive/My Drive/Colab Notebooks/dataworkshop_matrix"

# + id="rwRW8lxbHn5Z" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 34} outputId="0bfffa1f-68f6-4e81-b587-02c952a36454" executionInfo={"status": "ok", "timestamp": 1581859650432, "user_tz": -60, "elapsed": 2240, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}}
# !mkdir data

# + id="WIttb-0PH5pZ" colab_type="code" colab={}
# !echo 'data' > .gitignore

# + id="CoTTJ_1nIrnf" colab_type="code" colab={}
# !git add .gitignore

# + id="REl5cA2uI1LG" colab_type="code" colab={}
data = dw.load_dataset('datafiniti/mens-shoe-prices') 

# + id="yNT850VyJdCk" colab_type="code" outputId="57ba8d97-8409-49b8-bb88-1233b1cb798c" executionInfo={"status": "ok", "timestamp": 1581859667789, "user_tz": -60, "elapsed": 1738, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 122}
df = data.dataframes['7004_1']
df.shape

# + id="CwZpnOJNJhWw" colab_type="code" outputId="5a41ab50-6ad2-435f-8c70-513e0eb0767c" executionInfo={"status": "ok", "timestamp": 1581859675240, "user_tz": -60, "elapsed": 585, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 666}
df.sample(5)

# + id="JDgZ8GUdJx3X" colab_type="code" outputId="a2132c76-01d7-4ea2-f57a-7391bc26fe09" executionInfo={"status": "ok", "timestamp": 1581859680530, "user_tz": -60, "elapsed": 563, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 221}
df.columns

# + id="cCXguuTzJ2gh" colab_type="code" outputId="7dd00da1-56b0-4025-b025-fbbf2e9e467b" executionInfo={"status": "ok", "timestamp": 1581859684197, "user_tz": -60, "elapsed": 578, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 102}
df.prices_currency.unique()

# + id="2bJ0UYOcJ8gk" colab_type="code" outputId="079429e4-c841-4ea8-d0b0-1752e22334b1" executionInfo={"status": "ok", "timestamp": 1581859688579, "user_tz": -60, "elapsed": 570, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 255}
df.prices_currency.value_counts()

# + id="E7IfU2AYKB3I" colab_type="code" outputId="065f7a10-7713-4df3-da2a-ce04d0f62ada" executionInfo={"status": "ok", "timestamp": 1581859692235, "user_tz": -60, "elapsed": 569, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 34}
df_usd = df[ df.prices_currency == 'USD' ].copy()
df_usd.shape

# + id="S09VjRXBKWfm" colab_type="code" outputId="603c1056-ada2-4369-a551-1ca9ba5df214" executionInfo={"status": "ok", "timestamp": 1581859694593, "user_tz": -60, "elapsed": 594, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 282}
df_usd['prices_amountmin'] = df_usd.prices_amountmin.astype(np.float)
df_usd['prices_amountmin'].hist()

# + id="TxyN8EJ1K4tZ" colab_type="code" outputId="73abb077-9b8a-49da-a66d-dc9661bceb63" executionInfo={"status": "ok", "timestamp": 1581859697587, "user_tz": -60, "elapsed": 610, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 34}
filter_max = np.percentile( df_usd['prices_amountmin'], 99 )
filter_max

# + id="9TbNV4ZiLkJM" colab_type="code" colab={}
df_usd_filter = df_usd[ df_usd['prices_amountmin'] < filter_max ]

# + id="xLHxVe5jMAcB" colab_type="code" outputId="463948ef-ff29-4b97-f830-ffbfb35ad01b" executionInfo={"status": "ok", "timestamp": 1581859704129, "user_tz": -60, "elapsed": 868, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 282}
df_usd_filter.prices_amountmin.hist(bins=100)

# + id="5vzckxISMHh4" colab_type="code" colab={}
# !git add matrix_one/matrix_day3.ipynb

# + id="R0xrxkUbMuri" colab_type="code" outputId="538ab68f-5a4b-4ce6-a58c-ae252c714dce" executionInfo={"status": "ok", "timestamp": 1581859765801, "user_tz": -60, "elapsed": 1975, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 68}
# !git commit -m "Read Men's Shoe Prices dataset from data.world"

# + id="duCvdwzqNY0b" colab_type="code" colab={}
# !git config --global user.email "<EMAIL>"
# !git config --global user.name "Netoperek5000"

# + id="b8MGSKBmNoAP" colab_type="code" outputId="678af4a4-a02b-4b1c-d5f7-590f1c8408e3" executionInfo={"status": "ok", "timestamp": 1581859772895, "user_tz": -60, "elapsed": 4127, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}} colab={"base_uri": "https://localhost:8080/", "height": 170}
# !git push -u origin master

# + id="jzJqvV0COb9K" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 34} outputId="b608f3a8-1d23-49f6-8545-cbfb484cadae" executionInfo={"status": "ok", "timestamp": 1581860454804, "user_tz": -60, "elapsed": 2609, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}}
# !git reset --hard 29008946fc2420fab29dfd9b884f1b3724b6f303

# + id="LdndKMgwO0Pi" colab_type="code" colab={"base_uri": "https://localhost:8080/", "height": 51} outputId="867ef436-ee45-4c5b-d9e6-2e8e3db7771c" executionInfo={"status": "ok", "timestamp": 1581860476939, "user_tz": -60, "elapsed": 1918, "user": {"displayName": "<NAME>", "photoUrl": "https://lh3.googleusercontent.com/a-/AAuE7mANIkiwzQ5VxI8UsM-Y3j6OcxJB3NLktuVma5aw=s64", "userId": "05306264895046572092"}}
# !git push -u origin master --force

StarcoderdataJupyterScriptsDedupFiltered