-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweather_api_EDA.py
57 lines (52 loc) · 1.09 KB
/
weather_api_EDA.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# %%
import plotly.express as px
from utils import (
apply_scaling,
get_current_and_forecast,
get_historical_weather,
segmented_palette,
run_forecast,
)
# from prophet import Prophet
# %%
for_df = get_current_and_forecast()
# %%
plot_df = for_df.melt(id_vars=["time"])
px.line(
plot_df,
x="time",
y="value",
color="variable",
color_discrete_sequence=segmented_palette,
)
# %%
his_df = get_historical_weather()
# %%
plot_df = his_df.melt(id_vars=["time"])
px.line(
plot_df,
x="time",
y="value",
color="variable",
color_discrete_sequence=segmented_palette,
)
# %%
px.imshow(
his_df.set_index("time").pipe(apply_scaling).T,
aspect="auto",
color_continuous_scale="RdBu_r",
)
# %%
# mod = Prophet()
# mod.fit(his_df.rename(columns={"time": "ds", "temperature_2m": "y"}))
# %%
future_df = run_forecast(
data=his_df, outcome="temperature_2m", feature_list=["temperature_2m", "rain"],
steps=7
)
# %%
px.line(data_frame=future_df, x="index", y="temperature_2m", color="type",
color_discrete_sequence=segmented_palette)
# %%
his_df
# %%