Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve get_city_forecast to pass tests #132

Merged
merged 2 commits into from
Apr 25, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix: Modify get_city_forecast returned result to pass tests
1. Date information is in a column instead of index.
2. UVI is now float instead of int.
  • Loading branch information
lahdjirayhan committed Apr 24, 2022
commit 212929b8a852646ed28e76ebce86ae5d6a64b4d9
5 changes: 5 additions & 0 deletions src/ozone/ozone.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ def _extract_forecast_data(self, data_obj: Any) -> pandas.DataFrame:
dict_of_frames[pol] = pandas.DataFrame(lst).set_index("day")

df = pandas.concat(dict_of_frames, axis=1)

# Convert to numeric while making non-numerics nan,
# and then convert to float, just in case there's int
df = df.apply(lambda x: pandas.to_numeric(x, errors="coerce")).astype(float)
df.index = pandas.to_datetime(df.index)
df = df.reset_index().rename(columns={"day": "date"})
return df

def _check_and_get_data_obj(
Expand Down