Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
# 19feb2023
|
2 |
#https://huggingface.co/spaces/keras-io/timeseries_forecasting_for_weather/
|
3 |
|
@@ -15,14 +16,14 @@ amonthday = int(today.strftime("%d"))
|
|
15 |
|
16 |
st.write(type(ayear))
|
17 |
st.write(("{}-{}-{}").format(ayear,amonth,amonthday))
|
18 |
-
adf = pd.DataFrame()
|
19 |
|
20 |
for i in range(ayear-backlogmax,ayear,1):
|
21 |
alink = ("https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=CLMTEMP&year={}&rformat=csv&station=HKO").format(str(i))
|
22 |
-
df = pd.read_csv(alink, skiprows=[0,1,2], skipfooter=3, engine='python',
|
23 |
st.write(i)
|
24 |
|
25 |
-
|
26 |
df = df.reset_index() # make sure indexes pair with number of rows
|
27 |
for index, row in df.iterrows():
|
28 |
if (row[2]!=amonth) or (row[3]!=amonthday):
|
@@ -30,8 +31,7 @@ for i in range(ayear-backlogmax,ayear,1):
|
|
30 |
|
31 |
st.write(row[0],row[1],row[2],row[3],row[4],amonth,amonthday)
|
32 |
adate = ("{}.{}.{} 00:00:00").format(row[2], row[1], row[0])
|
33 |
-
|
34 |
-
nparray = [adate,"",row[4],"","","","","","","","","","","",""]
|
35 |
-
adf = pd.concat([adf, pd.DataFrame(nparray)], axis=0)
|
36 |
break
|
37 |
-
|
|
|
|
1 |
+
|
2 |
# 19feb2023
|
3 |
#https://huggingface.co/spaces/keras-io/timeseries_forecasting_for_weather/
|
4 |
|
|
|
16 |
|
17 |
st.write(type(ayear))
|
18 |
st.write(("{}-{}-{}").format(ayear,amonth,amonthday))
|
19 |
+
adf = pd.DataFrame(columns=["Date Time","p (mbar)","T (degC)","Tpot (K)","Tdew (degC)","rh (%)","VPmax (mbar)","VPact (mbar)","VPdef (mbar)","sh (g/kg)","H2OC (mmol/mol)","rho (g/m**3)","wv (m/s)","max. wv (m/s)","wd (deg)"])
|
20 |
|
21 |
for i in range(ayear-backlogmax,ayear,1):
|
22 |
alink = ("https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=CLMTEMP&year={}&rformat=csv&station=HKO").format(str(i))
|
23 |
+
df = pd.read_csv(alink, skiprows=[0,1,2], skipfooter=3, engine='python', on_bad_lines='skip')
|
24 |
st.write(i)
|
25 |
|
26 |
+
nparray = np.array([])
|
27 |
df = df.reset_index() # make sure indexes pair with number of rows
|
28 |
for index, row in df.iterrows():
|
29 |
if (row[2]!=amonth) or (row[3]!=amonthday):
|
|
|
31 |
|
32 |
st.write(row[0],row[1],row[2],row[3],row[4],amonth,amonthday)
|
33 |
adate = ("{}.{}.{} 00:00:00").format(row[2], row[1], row[0])
|
34 |
+
np.append([adate,"",row[4],"","","","","","","","","","","",""],nparray)
|
|
|
|
|
35 |
break
|
36 |
+
adf = pd.concat([adf, pd.DataFrame(nparray)], axis=0)
|
37 |
+
st.dataframe(adf)
|