diff --git a/pybaseball/team_results.py b/pybaseball/team_results.py index 6e7c44ce..796b9615 100644 --- a/pybaseball/team_results.py +++ b/pybaseball/team_results.py @@ -72,7 +72,7 @@ def get_table(soup: BeautifulSoup, team: str) -> pd.DataFrame: df = df.rename(columns=df.iloc[0]) df = df.reindex(df.index.drop(0)) df = df.drop('', axis=1) #not a useful column - df['Attendance'].replace(r'^Unknown$', np.nan, regex=True, inplace = True) # make this a NaN so the column can benumeric + df['Attendance'] = df['Attendance'].replace(r'^Unknown$', np.nan, regex=True) # make this a NaN so the column can be numeric return df def process_win_streak(data: pd.DataFrame) -> pd.DataFrame: diff --git a/tests/pybaseball/data/team_results.html b/tests/pybaseball/data/team_results.html new file mode 100644 index 00000000..3c933b0a --- /dev/null +++ b/tests/pybaseball/data/team_results.html @@ -0,0 +1,12 @@ +
+| Gm# | Date | Tm | Opp | HA | WL | R | RA | Inn | Rank | GB | Win | Loss | Save | Time | DN | Streak | Attendance | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2019-04-01 | NYY | BAL | Home | W | 5 | 3 | 9 | 1 | -- | SmithA | JonesB | None | 3:01 | D | +1 | Unknown | x | |
| 2019-04-02 | NYY | BAL | Home | L | 2 | 4 | 9 | 2 | 1.0 | DoeC | RoeD | None | 2:55 | N | -1 | 40,000 | x | |
| Description row to be skipped |