Loading data, getting None

Hello!
First of all, I want to say that I am new to this Streamlit package, and found it absolutely interesting for creating very quick web app.

To learn how to use this package, I am trying to build different kind of web app. I have created already a really small application, without machine learning implemented.
Now with this second, I want to imlement it.

The problem I found is that, when I want to load the csv file, and want to show it on the app, it show always the value None, which clearly its incorrect.

This is the code I use for loading the data and saving it on the cache

 @st.cache
def load_data():
    df=pd.read_csv('Star_Classes.csv')
    
    
df=load_data()
df

Someone knows how to solve this small issue?

Hi @marcolivierbertoz, welcome to th eStreamlit community!

You need to add return df to your load_data() function. As it is now, that function returns None because there is no return statement.

Best,
Randy

1 Like

Hi @randyzwitch ,

thank you very much for the answer.

I am asking myself how I missed that basic thing when creating a function.

Thank you again!

Cordially

Marc

1 Like