Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
Steam Data Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Max Väistö
Steam Data Project
Commits
6dc602f9
Commit
6dc602f9
authored
1 year ago
by
Max Väistö
Browse files
Options
Downloads
Patches
Plain Diff
Added market performance function to branch
parent
fa2404fe
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
visual_presentation/Market_performance_function.py
+1
-63
1 addition, 63 deletions
visual_presentation/Market_performance_function.py
with
1 addition
and
63 deletions
visual_presentation/Market_performance_function.py
+
1
−
63
View file @
6dc602f9
...
@@ -2,69 +2,7 @@ from typing import Sequence, Optional, Any
...
@@ -2,69 +2,7 @@ from typing import Sequence, Optional, Any
import
pandas
as
pd
import
pandas
as
pd
import
plotly.express
as
px
import
plotly.express
as
px
from
dash_plot_generation.utils
import
get_owner_means
,
convert_owners_to_limits
,
split_companies
# Three functions by Max, to get the mean value of game owner and split the company names.
DEFAULT_ILLEGAL_CONTINUATIONS
=
{
"
INC.
"
,
"
LLC
"
,
"
CO.
"
,
"
LTD.
"
,
"
S.R.O.
"
}
def
get_owner_means
(
owner_limits
:
Sequence
[
Any
]):
if
not
isinstance
(
owner_limits
,
list
):
return
owner_limits
else
:
return
(
owner_limits
[
0
]
+
owner_limits
[
1
])
/
2
def
convert_owners_to_limits
(
owner_limit
):
if
not
isinstance
(
owner_limit
,
str
):
return
owner_limit
owners_raw
=
[
rev
.
replace
(
"
"
,
""
)
for
rev
in
owner_limit
.
split
(
"
..
"
)]
owners_clean
=
[]
for
owner_limit
in
owners_raw
:
owner_limit
=
owner_limit
.
replace
(
"
M
"
,
"
0
"
*
6
)
owner_limit
=
owner_limit
.
replace
(
"
k
"
,
"
0
"
*
3
)
owners_clean
.
append
(
int
(
owner_limit
))
return
owners_clean
def
split_companies
(
arr
,
illegal_continuations
:
Optional
[
Sequence
[
str
]]
=
None
):
"""
Splits the given string at comma sign as long as following the comma none of the illegal
continuations happen. In such a case, the string split does not happen that said comma.
:param arr: Array containing the developers/publishers for a single game
:param illegal_continuations: A list of illegal continuations. Must be uppercase.
:return: Returns the given split input string as a list.
:note: If the arr is numpy.NaN, this value is returned instead of a list.
"""
if
illegal_continuations
is
None
:
illegal_continuations
=
DEFAULT_ILLEGAL_CONTINUATIONS
if
pd
.
isna
(
arr
):
return
arr
results_list
=
[]
start_index
=
0
split_char
=
"
,
"
for
index
in
range
(
len
(
arr
)):
if
index
<
len
(
arr
)
-
1
:
txt
=
arr
[
index
:
index
+
2
]
if
txt
==
split_char
:
found_illegal
=
False
min_continuation
=
min
([
len
(
continuation
)
for
continuation
in
illegal_continuations
])
max_continuation
=
max
([
len
(
continuation
)
for
continuation
in
illegal_continuations
])
next_chars
=
arr
[
index
+
min_continuation
:
index
+
min_continuation
+
max_continuation
]
for
i
in
range
(
index
+
min_continuation
,
index
+
len
(
next_chars
)
+
2
):
comp_txt
=
arr
[
index
+
2
:
i
+
2
].
upper
()
if
comp_txt
in
illegal_continuations
:
found_illegal
=
True
break
if
not
found_illegal
:
results_list
.
append
(
arr
[
start_index
:
index
].
strip
())
start_index
=
index
+
1
elif
index
==
len
(
arr
)
-
1
:
results_list
.
append
(
arr
[
start_index
:
index
+
1
].
strip
())
return
results_list
# The function to plot the bubble chart of market performance
# The function to plot the bubble chart of market performance
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment