Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,11 +10,22 @@ backlogmax = 4
|
|
10 |
today = datetime.date.today()
|
11 |
|
12 |
ayear = int(today.strftime("%Y"))-1
|
|
|
|
|
|
|
13 |
st.write(type(ayear))
|
|
|
|
|
|
|
14 |
for i in range(ayear-backlogmax,ayear,1):
|
15 |
alink = ("https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=CLMTEMP&year={}&rformat=csv&station=HKO").format(str(i))
|
16 |
-
df = pd.read_csv(alink, skiprows=[1,2
|
17 |
st.write(i)
|
|
|
|
|
18 |
df = df.reset_index() # make sure indexes pair with number of rows
|
19 |
for index, row in df.iterrows():
|
20 |
-
|
|
|
|
|
|
|
|
10 |
today = datetime.date.today()
|
11 |
|
12 |
ayear = int(today.strftime("%Y"))-1
|
13 |
+
amonth = int(today.strftime("%m"))
|
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', error_bad_lines=True)
|
23 |
st.write(i)
|
24 |
+
|
25 |
+
nparray = np.array([])
|
26 |
df = df.reset_index() # make sure indexes pair with number of rows
|
27 |
for index, row in df.iterrows():
|
28 |
+
adate = ("{}.{}.{} 00:00:00").format(row[2], row[1], row[0])
|
29 |
+
# np.append([adate,,row[4],,,,,,,,,,,,],nparray)
|
30 |
+
st.write(row[0],row[1],row[2],row[3])
|
31 |
+
# adf = pd.concat([adf, pd.DataFrame(nparray), axis=0)
|