feat: substituir guardar_json pelo utils.save_as_json
Mudei um pouco o save_as_json e talvez tenha ficado um pouco nojento porque não sabia muito bem como fazer uso das EVENT_COLS e STATION_COLS de dentro do utils.py
This commit is contained in:
@@ -9,9 +9,10 @@ from typing import Any
|
||||
import pandas as pd
|
||||
|
||||
|
||||
def save_as_json(info: dict[str, Any]) -> bool:
|
||||
with open("test.json", "w") as fp:
|
||||
json.dump(info, fp)
|
||||
def save_as_json(df: pd.DataFrame, fname, event_cols, station_cols) -> bool:
|
||||
info = create_dict_struct(df, event_cols, station_cols)
|
||||
with open(fname, "w") as fp:
|
||||
json.dump(info, fp, indent=4)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user