Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Recommend.Games
Blog
Commits
1991dc7a
Verified
Commit
1991dc7a
authored
Jul 31, 2021
by
Markus Shepherd
🙊
Browse files
some basic analysis
parent
849464d4
Pipeline
#436853
passed with stage
in 27 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
experiments/co_ops/co_ops.py
View file @
1991dc7a
...
...
@@ -14,6 +14,7 @@
# ---
# %%
from
datetime
import
date
import
pandas
as
pd
pd
.
options
.
display
.
max_columns
=
100
...
...
@@ -29,4 +30,16 @@ games = pd.read_csv(
index_col
=
"bgg_id"
,
low_memory
=
False
,
)
games
.
drop
(
index
=
games
[
games
[
"compilation_of"
].
notna
()].
index
,
inplace
=
True
)
games
[
"cooperative"
]
=
games
[
"cooperative"
].
fillna
(
False
).
astype
(
bool
)
games
.
shape
# %%
games
[
"cooperative"
].
mean
()
# %%
games
[
games
[
"cooperative"
]].
sort_values
(
"year"
).
head
(
10
)
# %%
years
=
games
.
groupby
(
"year"
)[
"cooperative"
].
agg
([
"size"
,
"sum"
,
"mean"
])
years
[(
years
.
index
>=
1900
)
&
(
years
.
index
<=
date
.
today
().
year
)]
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment