Skip to content

Commit

Permalink
Merge pull request #58 from UBC-MDS/carlina_final
Browse files Browse the repository at this point in the history
implementing changes to boxplot and altair tests changed
  • Loading branch information
AndresPitta authored Mar 23, 2020
2 parents 2fdf580 + ffc3747 commit e3bcc47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions pysketball/nba_boxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
def nba_boxplot(dataset, stats, position=None, teams=None):
"""
Creates a boxplot of the categorical variable of interest on the y-axis and
the stat of interest on the x-axis.
the stat of interest on the x-axis. You can only use one of position or
teams argument for categorical variable and stats argument must be chosen.
Parameters:
-----------
Expand Down Expand Up @@ -68,8 +69,8 @@ def nba_boxplot(dataset, stats, position=None, teams=None):
raise TypeError("teams must be a list")

# Checks if the position exists in the dataframe
if position is not None and position not in dataset.columns:
raise TypeError(f"Column {position} not found in data")
if position is not None and position is not 'POS':
raise TypeError("Must input 'POS' in position argument")

# Checks if the stats exists in the dataframe
if stats not in dataset.columns:
Expand Down
4 changes: 2 additions & 2 deletions tests/test_nba_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_nba_ranking_output():
data, 'C', 'B', top=2, ascending=True, fun='mean')[0], pd.DataFrame)
assert isinstance(nba_ranking.nba_ranking(data, 'C', 'B', top=2,
ascending=False, fun='mean')[1],
alt.vegalite.v4.api.LayerChart)
alt.vegalite.api.LayerChart)
assert isinstance(nba_ranking.nba_ranking(data, 'C', 'B', top=15,
ascending=True, fun='mean')[1],
alt.vegalite.v4.api.LayerChart)
alt.vegalite.api.LayerChart)

0 comments on commit e3bcc47

Please sign in to comment.