Verified Commit d0747c0e authored by Markus Shepherd's avatar Markus Shepherd 🙊
Browse files

first version of climbers.py

parent f4526e50
Pipeline #452793 passed with stage
in 23 seconds
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[requires]
python_version = "3.8"
[packages]
board-game-recommender = "*"
board-game-utils = "*"
bokeh = "*"
imbalanced-learn = "*"
jupyterlab = "*"
jupytext = "*"
matplotlib = "*"
nb-black = "*"
numpy = "*"
pandas = "*"
pytility = "*"
requests = "*"
scikit-learn = "*"
scipy = "*"
seaborn = "*"
shap = "*"
tabulate = "*"
tqdm = "*"
[dev-packages]
pylint = "*"
This diff is collapsed.
# ---
# jupyter:
# jupytext:
# formats: ipynb,py:percent
# text_representation:
# extension: .py
# format_name: percent
# format_version: '1.3'
# jupytext_version: 1.11.1
# kernelspec:
# display_name: Python 3
# language: python
# name: python3
# ---
# %%
import pandas as pd
# %load_ext nb_black
# %load_ext lab_black
# %%
games = pd.read_csv(
"../../../board-game-data/scraped/bgg_GameItem.csv",
index_col="bgg_id",
low_memory=False,
)
games.shape
# %%
ratings1 = pd.read_csv(
"../../../board-game-data/rankings/bgg/bgg/20211013-000000.csv",
index_col="bgg_id",
)
ratings1.dropna(inplace=True)
ratings1.shape
# %%
ratings2 = pd.read_csv(
"../../../board-game-data/rankings/bgg/bgg/20211020-000000.csv",
index_col="bgg_id",
)
ratings2.dropna(inplace=True)
ratings2.shape
# %%
data = games[["name", "num_votes"]].join(
ratings1.join(ratings2, lsuffix="_1", rsuffix="_2")
)
data["rank_increase"] = data["rank_1"] - data["rank_2"]
data["rank_increase_pct"] = 1 - data["rank_2"] / data["rank_1"]
data["score_increase"] = data["score_2"] - data["score_1"]
data["score_increase_pct"] = data["score_2"] / data["score_1"] - 1
data.shape
# %%
data.sort_values("rank_increase_pct", ascending=False)[:50]
# %%
data.sort_values("score_increase", ascending=False)[:50]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment