From 463e220f783037fe8cc9bea4ee0a5fb04b2825c4 Mon Sep 17 00:00:00 2001 From: Carlina Kim Date: Sun, 22 Mar 2020 19:27:07 -0700 Subject: [PATCH 1/2] implementing changes to boxplot and altair tests changed --- pysketball/nba_boxplot.py | 7 ++++--- tests/test_nba_ranking.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pysketball/nba_boxplot.py b/pysketball/nba_boxplot.py index 39b8786..b1453a9 100644 --- a/pysketball/nba_boxplot.py +++ b/pysketball/nba_boxplot.py @@ -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: ----------- @@ -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 != 'POS': + raise TypeError("Must input 'POS' in position argument") # Checks if the stats exists in the dataframe if stats not in dataset.columns: diff --git a/tests/test_nba_ranking.py b/tests/test_nba_ranking.py index c7dc327..9f53356 100644 --- a/tests/test_nba_ranking.py +++ b/tests/test_nba_ranking.py @@ -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) From ffc3747c12cb2896c5be0c0fbd04d33426cd1236 Mon Sep 17 00:00:00 2001 From: Carlina Kim Date: Sun, 22 Mar 2020 20:25:11 -0700 Subject: [PATCH 2/2] adding changes suggested --- pysketball/nba_boxplot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pysketball/nba_boxplot.py b/pysketball/nba_boxplot.py index b1453a9..ff95826 100644 --- a/pysketball/nba_boxplot.py +++ b/pysketball/nba_boxplot.py @@ -69,7 +69,7 @@ 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 != 'POS': + 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