import eia_api as api
import eia_data
import pandas as pd
@@ -130,7 +130,7 @@ Load libraries
import great_tables as gt
API Settings:
-
+
-
= open("../metadata/series.json")
raw_json = json.load(raw_json)
meta_json = pd.DataFrame(meta_json["series"])
@@ -148,7 +148,7 @@ series Load libraries
= "../metadata/ciso_log_py.csv"
meta_path = "../csv/ciso_grid_py.csv" data_path
+
-
# api_metadata = api.eia_metadata(api_key = eia_api_key, api_path = api_path)
@@ -156,55 +156,55 @@ Load libraries
# end = pd.to_datetime(api_metadata.meta["endPeriod"])
# print(end)
+
= eia_data.get_metadata(api_key = eia_api_key, api_path = api_path, meta_path = meta_path, series = series)
meta_obj
gt.GT(meta_obj.request_meta,)
-
+
-
@@ -225,7 +225,7 @@ PGAE
2024-08-26 07:00:00
2024-08-26 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
@@ -233,7 +233,7 @@ SCE
2024-08-23 07:00:00
2024-08-23 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
@@ -241,7 +241,7 @@ SDGE
2024-11-01 07:00:00
2024-11-01 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
@@ -249,7 +249,7 @@ VEA
2024-11-01 07:00:00
2024-11-01 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
@@ -260,7 +260,7 @@
Load libraries
Load libraries
Load libraries
Load libraries
Load libraries
+
-
= meta_obj.request_meta
m = meta_obj.last_index + 1
index = None
@@ -324,53 +324,53 @@ data Load libraries
{'parent': 'CISO', 'subba': 'VEA'}
+
= "index") gt.GT(meta_new,rowname_col
-
+
-
@@ -400,14 +400,14 @@
CISO
PGAE
-2025-01-08 00:26:00.154682+00:00
+2025-01-08 12:10:53.688882+00:00
2024-08-26 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
2024-08-26 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
True
-3217
+3241
54
refresh
False
@@ -418,14 +418,14 @@
CISO
SCE
-2025-01-08 00:26:01.799011+00:00
+2025-01-08 12:10:55.527862+00:00
2024-08-23 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
2024-08-23 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
True
-3289
+3313
63
refresh
False
@@ -436,14 +436,14 @@
CISO
SDGE
-2025-01-08 00:26:02.511470+00:00
+2025-01-08 12:10:56.369510+00:00
2024-11-01 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
2024-11-01 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
True
-1609
+1633
48
refresh
False
@@ -454,14 +454,14 @@
CISO
VEA
-2025-01-08 00:26:03.810728+00:00
+2025-01-08 12:10:57.143303+00:00
2024-11-01 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
2024-11-01 08:00:00
-2025-01-07 08:00:00
+2025-01-08 08:00:00
True
True
-1609
+1633
48
refresh
False
@@ -476,13 +476,13 @@
Load libraries
Load libraries
Load libraries
Load libraries
Load libraries
+
= eia_data.append_metadata(meta_path = meta_path, meta = meta_new, save = True, init = False) meta_updated
Plot the Series
We will use Plotly to visualize the series:
-
+
-
if data is not None:
= data.sort_values(by = ["subba", "period"])
d = px.line(data, x="period", y="value", color="subba")
@@ -490,9 +490,9 @@ p Plot the Series
else:
print("No new data is available")
-
+
= pd.read_csv(data_path)
full_data
full_data.head()
@@ -525,9 +525,9 @@ Plot the Series
= px.line(full_data, x="period", y="value", color="subba")
p p.show()
-