Project setup
Before writing any analysis code, you’ll create a clean, isolated project environment usinguv.
1
Initialize the project
2
Create the folder structure
A clean layout keeps your source code, data files, and outputs organized:Create the folders and move the default script:
3
Install dependencies
.venv automatically and locks exact package versions in uv.lock for reproducibility.Fetch 7 days of weather data
The Open-Meteo API provides historical weather data with no authentication required. The following code calculates the date range and builds the request URL dynamically:Load the data into pandas
Organize the API response into a structured DataFrame:Visualize the data
Create a line chart showing max, min, and average temperature over the week:Save the data to CSV
Complete example
Here’s the full script in one place, ready to run from thesrc/ directory:
What you’ve accomplished
Look at what this project brings together:- Real API integration — fetching live data from a public HTTP endpoint
- Date arithmetic — computing dynamic date ranges with
datetimeandtimedelta - Data processing — reshaping and enriching a DataFrame with pandas
- Visualization — producing a multi-series chart with matplotlib
- File handling — creating directories and saving CSV and image files
- Project structure — organized folders, a virtual environment, and locked dependencies
What’s next?
Now that you’ve built and organized a complete Python project, the next step is creating interactive web interfaces and AI dashboards using Streamlit.Building UIs with Streamlit
Create interactive web applications and AI dashboards