@@ -77,7 +77,7 @@ def load_data():
7777 else :
7878 st .write (f"📅 Running predictions for **{ year } -{ month :02d} ** | Region: **{ region } **" )
7979
80- payload = fe_df .loc [idx ].to_dict (orient = "records" )
80+ payload = fe_df .loc [idx ].replace ([ float ( "inf" ), float ( "-inf" )], 0 ). fillna ( 0 ). to_dict (orient = "records" )
8181
8282 try :
8383 resp = requests .post (API_URL , json = payload , timeout = 60 )
@@ -115,7 +115,7 @@ def load_data():
115115 if region == "All" :
116116 yearly_data = disp_df [disp_df ["year" ] == year ].copy ()
117117 idx_all = yearly_data .index
118- payload_all = fe_df .loc [idx_all ].to_dict (orient = "records" )
118+ payload_all = fe_df .loc [idx_all ].replace ([ float ( "inf" ), float ( "-inf" )], 0 ). fillna ( 0 ). to_dict (orient = "records" )
119119
120120 resp_all = requests .post (API_URL , json = payload_all , timeout = 60 )
121121 resp_all .raise_for_status ()
@@ -126,7 +126,7 @@ def load_data():
126126 else :
127127 yearly_data = disp_df [(disp_df ["year" ] == year ) & (disp_df ["region" ] == region )].copy ()
128128 idx_region = yearly_data .index
129- payload_region = fe_df .loc [idx_region ].to_dict (orient = "records" )
129+ payload_region = fe_df .loc [idx_region ].replace ([ float ( "inf" ), float ( "-inf" )], 0 ). fillna ( 0 ). to_dict (orient = "records" )
130130
131131 resp_region = requests .post (API_URL , json = payload_region , timeout = 60 )
132132 resp_region .raise_for_status ()
0 commit comments