Getting data from yfinance only loads today’s date on the deployed site but it works fine locally. When I download my data on the deployed site, I only have 1 row of data compared to when I download my data from running my app locally, I can download the whole dataset.
Attached file contains a picture of the deployed site and the data downloaded compared to the local app.
Deployed:
Local:
Code:
interv = st.select_slider('Select Time Series Data Interval for Prediction', options=[
'Weekly', 'Monthly', 'Quarterly', 'Daily'])
st.table(df.head())
@st.cache(persist=True, allow_output_mutation=True)
def getInterval(argument):
switcher = {
"W": "1wk",
"M": "1mo",
"Q": "3mo",
"D": "1d"
}
return switcher.get(argument, "1wk")
df = yf.download('BZ=F', interval=getInterval(interv[0]))
df = df.reset_index()
@st.cache
def convert_df(df):
# IMPORTANT: Cache the conversion to prevent computation on every rerun
return df.to_csv().encode('utf-8')
csv = convert_df(df)
st.download_button(
label="Download data as CSV",
data=csv,
file_name='Brent Oil Prices.csv',
mime='text/csv',
)