Skip to content

Commit 2fdf580

Browse files
authored
Merge pull request #59 from UBC-MDS/review_fixes
Review fixes
2 parents 3b1834e + cc00014 commit 2fdf580

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

pyproject.toml

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
name = "pysketball"
33
version = "2.0.0"
44
description = "This is a Python package that scraps tabular ESPN NBA data from https://www.espn.com/nba/stats/player/_/season/2019/seasontype/2 and processes it"
5-
authors = ["Andres Pitta <[email protected]>"]
5+
authors = [
6+
"Andres Pitta <[email protected]>",
7+
"Anand Shankar, <[email protected]>",
8+
"Carlina Kim, <[email protected]>",
9+
"Kenneth Foo, <[email protected]>"
10+
]
611
license = "MIT"
712
readme = "README.md"
813
homepage = "https://github.com/UBC-MDS/pysketball"

pysketball/nba_scraper.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def nba_scraper(season_year, season_type="regular", csv_path=None):
1919
season_year : int
2020
An integer input of the year of interest for the NBA season.
2121
season_type : string
22-
A string input of the NBA season type (either "regular" or playoff).
22+
A string input of the NBA season type (either "regular" or
23+
"postseason").
2324
Default is "regular".
2425
csv_path_name : string
2526
A string input stating the path to store the scraped csv file and

pysketball/nba_team_stats.py

+22-1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,27 @@ def nba_team_stats(nba_data, stats_filter=None, teams_filter=None,
4242
stats_filter = ['GP', '3PM', 'FT%'],
4343
teams_filter = ['UTAH', 'PHX', 'DET'],
4444
positions_filter = ['C', 'PG'])
45+
{'GP': count mean std min 25% 50% 75% max
46+
Team POS
47+
DET C 2.0 73.5 7.778175 68.0 70.75 73.5 76.25 79.0
48+
PG 1.0 82.0 NaN 82.0 82.00 82.0 82.00 82.0
49+
PHX C 1.0 71.0 NaN 71.0 71.00 71.0 71.00 71.0
50+
UTAH C 1.0 81.0 NaN 81.0 81.00 81.0 81.00 81.0
51+
PG 1.0 68.0 NaN 68.0 68.00 68.0 68.00 68.0,
52+
'3PM': count mean std min 25% 50% 75% max
53+
Team POS
54+
DET C 2.0 0.05 0.070711 0.0 0.025 0.05 0.075 0.1
55+
PG 1.0 2.10 NaN 2.1 2.100 2.10 2.100 2.1
56+
PHX C 1.0 0.00 NaN 0.0 0.000 0.00 0.000 0.0
57+
UTAH C 1.0 0.00 NaN 0.0 0.000 0.00 0.000 0.0
58+
PG 1.0 1.20 NaN 1.2 1.200 1.20 1.200 1.2,
59+
'FT%': count mean std min 25% 50% 75% max
60+
Team POS
61+
DET C 2.0 68.6 13.57645 59.0 63.8 68.6 73.4 78.2
62+
PG 1.0 86.4 NaN 86.4 86.4 86.4 86.4 86.4
63+
PHX C 1.0 74.6 NaN 74.6 74.6 74.6 74.6 74.6
64+
UTAH C 1.0 63.6 NaN 63.6 63.6 63.6 63.6 63.6
65+
PG 1.0 85.5 NaN 85.5 85.5 85.5 85.5 85.5}
4566
"""
4667
# Check if nba_data is a DataFrame
4768
if not isinstance(nba_data, pd.DataFrame):
@@ -109,6 +130,6 @@ def nba_team_stats(nba_data, stats_filter=None, teams_filter=None,
109130
stats_filter = [stat for stat in stats_filter if stat not in (
110131
'NAME', 'TEAM', 'POS')]
111132
for stat in stats_filter:
112-
stats[stat] = nba_data.groupby(group_by).describe()[stat]
133+
stats[stat] = nba_data.groupby(group_by).describe().round(3)[stat]
113134

114135
return stats

0 commit comments

Comments
 (0)