r/learnpython • • 6d ago

Need feedback

I made my first big python project as a beginner high school student. It visualizes CO2 emission trends and compares with countries and compares gdp, population and other stuff. It uses matplotlib, numpy, seaborn, streamlit and pandas.
link: https://github.com/rapanjeetsingh/python-project

4 Upvotes

3 comments sorted by

1

u/ad1tya_24 3d ago

Took a look through your repo and the live Streamlit app. For a first big project in high school, this is genuinely really well done.

Using u/st.cache_data on your data loader right out of the gate was smart. The most common mistake beginners make with Streamlit is letting the script re-read multiple CSVs from disk every time someone touches a slider or dropdown. Also good catch remembering plt.close(fig) after st.pyplot()—a lot of people forget that and run into memory leaks over long sessions.

A couple of small things you could tweak if you want to make it even cleaner:

  1. In app.py, pd.read_csv(filename) relies on your terminal running from the exact project folder. If you run streamlit run from an outer directory or import it elsewhere, it will throw a FileNotFoundError. A common pattern to prevent that is:
pythonfrom pathlib import Path
BASE_DIR = Path(__file__).resolve().parent
# then load with: BASE_DIR / filename
  1. Static Matplotlib and Seaborn graphs do the job, but for historical data comparisons, you might want to look into plotly.express (px.line) and st.plotly_chart. Having interactive hover tooltips so someone can see the exact number for a specific year makes comparing countries a lot nicer.
  2. Small typo in your README: under step 1, the clone instructions and headers got pasted twice by accident.

Really clean work on the UI and data cleaning. Definitely keep at it.

1

u/Ok_Step1507 3d ago

Thank you for the feedback! I will use it to improve my project for future.