-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
# Import code from the src/ directory | ||
import json | ||
import pandas as pd | ||
|
||
from src.fetch import get_data | ||
from src.save import write_data | ||
#from src.save import write_data | ||
from os.path import abspath | ||
|
||
data = get_data() | ||
write_data(abspath("./data/superforecasts.csv"), data) | ||
#write_data(abspath("./data/superforecasts.csv"), data) | ||
|
||
# Step 1: Parse the JSON string to a Python object (list of dictionaries) | ||
json_data = json.loads(data) | ||
|
||
# Step 2: Convert the parsed JSON into a Pandas DataFrame | ||
df = pd.DataFrame(json_data) | ||
|
||
df.to_csv(abspath("./data/superforecasts.csv")) |