@ st.cache_data vs @st.cache_resource

Hi,
why when I tried to print the result of info_fonds nothing is printed but when I change the @ st.cache_data to @st.cache_resource it works ?

@st.cache_data
def info_fonds(code_fonds):
    url = f'https://www.quantalys.com/Fonds/Investir/{code_fonds}'  
    soup = BeautifulSoup(requests.get(url).content, "html.parser")
    data = [info_fonds.text.strip() for info_fonds in soup.find_all('dd')]
    ind = [index.text.strip() for index in soup.find_all('dt')]
    df = pd.DataFrame(data, index=ind).rename({0 : 'Caractéristiques'}, axis=1)
    df.loc['SRI', 'Caractéristiques'] = soup.find('div', class_='indic-srri indic-srri-selected').string
    return df

### code 
info = info_fonds(numero_fonds)
st.dataframe(info.loc[['Code ISIN', 
                                       'Devise', 
                                       'Domicile', 
                                       'Indice de référence', 
                                       'Gérant', 
                                       'Date de création',
                                       'Frais de gestion maxi',
                                       'Frais Courants',
                                       'Commission de surperformance'
                                       ]
                                      ], 
                             use_container_width=True
                             )
...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.