a10's picture
Update app.py
2eee744
raw
history blame
703 Bytes
# 19feb2023
#https://huggingface.co/spaces/keras-io/timeseries_forecasting_for_weather/
import streamlit as st
import datetime
import pandas as pd
import numpy as np
backlogmax = 4
today = datetime.date.today()
ayear = int(today.strftime("%Y"))-1
st.write(type(ayear))
for i in range(ayear-backlogmax,ayear,1):
alink = ("https://data.weather.gov.hk/weatherAPI/opendata/opendata.php?dataType=CLMTEMP&year={}&rformat=csv&station=HKO").format(str(i))
df = pd.read_csv(alink, skiprows=[1,2,3], skipfooter=3, engine='python', error_bad_lines=True)
st.write(i)
df = df.reset_index() # make sure indexes pair with number of rows
for index, row in df.iterrows():
st.write(row[0],row[1],row[2],row[3])