Create a CSV Dataset Explorer
Level: Beginner · Time: 25–35 min · Category: Data app
Tags: Python · Streamlit · Prompting
Use AI coding assistance to build a small Streamlit app for previewing, filtering, and summarizing CSV files.
This is a good first AI-assisted project because every change is visible in the browser and the app can stay local.
Prerequisites
- LLM API Guide — set up API access so an assistant can help explain and extend the app.
- Use Python with the LLM gateway — review basic Python environment and SDK setup.
- Python — install Python if your workstation does not already have it.
- Sample CSV — download a small lab-results CSV for testing the tutorial app.
Confirm Python 3 and pip are available before you start:
- macOS / Linux
- Windows (PowerShell)
python3 --version # expect 3.9 or newer
python3 -m pip --version
python --version # expect 3.9 or newer
python -m pip --version
If Python is not found, install it from python.org. On the supercomputer, load a Python module instead (for example module load python), then run the checks again.
What you will do
- Install Streamlit and pandas.
- Prompt for a first local data explorer.
- Ask for careful improvements like filters and downloads.
- Troubleshoot common CSV and dependency problems.
Build it step by step
1. Install dependencies
Create a small Python environment for the app. This keeps Streamlit dependencies separate from other projects.
- macOS / Linux
- Windows (PowerShell)
mkdir dataset-explorer
cd dataset-explorer
python3 -m venv .venv
source .venv/bin/activate
pip install streamlit pandas
mkdir dataset-explorer
cd dataset-explorer
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install streamlit pandas
If you track this project with Git, do not commit your virtual environment or any secrets. Create a .gitignore file in the project folder with at least these lines:
.venv/
.env
__pycache__/
.venv/ is large and specific to your machine, and .env holds your API key — neither belongs in a shared repository. New to Git? See Track a New Project with Git.
2. Ask for the first app
Give the assistant the app goal, the dependencies it may use, and the safety constraints around uploaded files.
You are helping me build a beginner Streamlit app.
Project goal:
- Let a user upload a CSV.
- Show the first rows.
- Show row count, column count, and missing value count.
- Let the user choose one column and show a simple summary.
Constraints:
- Use Streamlit and pandas.
- Keep the first version in app.py.
- Add friendly errors for malformed CSV files.
- Do not add a database or login.
- I will test with a sample file named lab-results-example.csv.
Please:
1. Create app.py.
2. Explain how to run it locally.
3. Suggest two small next improvements.
3. Run and test with the sample CSV
Start Streamlit and test with the sample lab-results file before trying a large research dataset.
curl -L -o lab-results-example.csv https://docs.rc.asu.edu/tutorials/lab-results-example.csv
streamlit run app.py
Or create the sample CSV manually:
cat > lab-results-example.csv <<'CSV'
sample_id,condition,replicate,day,value,unit,passed_qc,notes
S001,control,1,0,12.4,ng/uL,true,Baseline sample
S002,control,2,0,11.8,ng/uL,true,Baseline sample
S003,control,3,0,13.1,ng/uL,true,Baseline sample
S004,treatment-a,1,1,18.6,ng/uL,true,Clear response
S005,treatment-a,2,1,17.9,ng/uL,true,Clear response
S006,treatment-a,3,1,,ng/uL,false,Instrument timeout
S007,treatment-b,1,1,15.2,ng/uL,true,Moderate response
S008,treatment-b,2,1,14.7,ng/uL,true,Moderate response
S009,treatment-b,3,1,15.9,ng/uL,true,Moderate response
S010,control,1,7,12.9,ng/uL,true,Follow-up
S011,treatment-a,1,7,21.4,ng/uL,true,Follow-up
S012,treatment-b,1,7,16.8,ng/uL,true,Follow-up
CSV
streamlit run app.py
4. Ask for one practical improvement
The best follow-up prompts name one feature and ask how to test it with a small file.
Please improve the dataset explorer with one focused feature:
Feature:
- Add a download button for the filtered dataframe.
Constraints:
- Keep the app beginner-readable.
- Do not rewrite the whole file if a smaller change works.
- Explain how to test the new button with lab-results-example.csv.
More prompts to try
- Add a date range filter, but only show it when a date-like column exists.
- Review this app for friendly errors when the uploaded CSV is malformed.
- Suggest three improvements for
lab-results-example.csvthat would help a collaborator who does not write Python, then wait for me to choose one.
Troubleshooting
- If
streamlitis not found, activate the virtual environment again and runpip install streamlit pandas. - If curl cannot download the sample file, use the manual CSV block above instead.
- If pandas cannot read the file, ask the assistant to add try/catch handling around
pd.read_csv. - If the app is slow with a large CSV, ask for row limits, cached loading, or column selection before display.
- If the assistant adds too many charts at once, ask it to revert and add one chart tied to one selected column.
Next steps
- Create a lab portal — turn a useful prototype into a more polished web portal.
- Configure OpenCode — use a coding assistant to make focused improvements.