Skip to content

Commit

Permalink
feat: Modify data conversion function to work with all functions that…
Browse files Browse the repository at this point in the history
… call it
  • Loading branch information
danfke committed Jan 21, 2022
1 parent 13a992e commit 1cf707f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/airpyllution/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ def convert_data_to_pandas(raw_data):
--------
>>> convert_data_to_pandas(data)
"""
data = pd.DataFrame.from_records(list(map(lambda x:x["components"],raw_data["list"])))
data["dt"] = list(map(lambda x:convert_unix_to_date(x["dt"]),raw_data["list"]))
try:
data = pd.DataFrame.from_records(list(map(lambda x:x["components"],raw_data["list"])))
data["dt"] = list(map(lambda x:convert_unix_to_date(x["dt"]),raw_data["list"]))
except:
data = raw_data["coord"]
data.update(raw_data["list"][0]["components"])
data = pd.DataFrame.from_records([data])
return data

0 comments on commit 1cf707f

Please sign in to comment.