awx

← Blog

Walk-through · 17 November 2026

How to clean and analyse a survey CSV with pandas

Give an agent a messy survey export. It cleans it, runs the tests and draws the charts, and it tells you what it removed. Then you check its numbers. This post follows a real run.

Almost every final-year project has a spreadsheet of survey answers, and almost every export is messy. People type "M", "male" and "man". They write "12hrs" in a number box. Some answer twice. Cleaning that by hand takes an evening, and a mistake there can change the result.

An agent on awx has a real computer with Python on it, so it can do the whole job and keep the scripts. We gave it a made-up study-habits survey and asked for the numbers a dissertation chapter might need. The most useful part was the list of things it told us to check.

Awi the cat agent looks closely through a magnifying glass

How we ran it

We have no real dissertation data to share, so the agent first made a stand-in file, survey.csv, with 118 invented respondents and the usual mess: ages of 150 and 2024, study hours of -3 and 168, a 26-hour night of sleep, gender written as M, man, nonbinary and PNTS, yes and no written as Y, true and 1, comma decimals like 3,45, units inside cells like 12hrs, missing answers written ten different ways, five exact duplicates and four sneaky near-duplicates.

Every number below comes from that invented file. They show how the workflow behaves and mean nothing about students. We used a Small computer.

The first message

I am a final-year student with a messy survey CSV for my
dissertation, and I want to analyse it with Python and pandas.
I do not have the real file here, so first make a stand-in in
/home/agent/survey: survey.csv with about 120 made-up responses
(columns: id, age, gender, hours_study_per_week, hours_sleep,
used_ai_tools, gpa, satisfaction 1-5). Make it messy the way real
survey exports are. Then clean it and tell me exactly what you
removed or changed and why. Report the mean and median of hours
studied and GPA, the correlation between study hours and GPA, and
whether students who use AI tools have a different GPA, with a
proper test, and say how much to trust it with this sample size.
Save two charts as PNG files in /home/agent/survey/charts. At the
end, list anything in your own analysis that I should double-check
before putting it in my dissertation.

Two sentences matter most: "tell me exactly what you removed or changed and why", and the last one, which makes the agent argue against its own work. With the real file you would say "I uploaded survey.csv to the Files tab" and leave out the stand-in part.

The agent worked for nine minutes and 55 steps. It installed pandas, NumPy, SciPy and matplotlib into a private folder of its own, so nothing on the computer was changed. It asked us before it wrote files and before one command that deleted its own output, and we read each one before pressing Approve. Its first three tries to save the long cleaning script failed because it gave the file tool a path in the wrong form. It noticed and split the script into two files.

What it cleaned, and why

The agent's list of what it cleaned: 10 of 127 rows removed, 22 bad cells blanked, 140 text cells standardised, numbers stored as text converted, nothing imputed, and every change in cleaning_log.csv; then a table of mean and median for study hours and GPA
The agent's account of what it changed, with the reason for each kind of change.

Every change went into cleaning_log.csv, one line each with the id, the old value, the new value and the reason. The original survey.csv was left alone. Your supervisor, or an examiner, can ask what you did to the data, and this file is the answer.

The terminal: the survey folder holds REPORT.md, the scripts, cleaned_survey.csv, cleaning_log.csv, results.json, charts and the original survey.csv; the log has lines like 59,gender,M,Male,standardised label and 96,gender,,,missing, 187 lines in all
The folder it left behind. The log is 187 lines long: a header, then one line for each change.

What it found

The agent's results: study hours r = 0.45; AI users 3.62 against 3.56 for non-users, difference +0.06, Welch t-test p = 0.50, with low power; and the start of a numbered list headed Please double-check these before your dissertation
The two results, and the start of the agent's own warning list.

The wording of the second result is what we wanted from it. The agent wrote "no evidence of a difference, but that is not evidence of no difference". With 56 and 37 students the test had about 10% power, and it could only reliably catch a gap of around 0.24 GPA points. A weaker tool would have said "AI use does not affect grades". It also repeated the comparison with study hours and sleep taken into account, and the answer stayed non-significant (p = 0.099).

Scatter chart of study hours against GPA with a red fitted line; many points sit exactly on 4.00, and one student studies 48 hours a week
Study hours against GPA. Look at the row of dots at 4.00.
Box plot of GPA for students who do not use AI tools and for students who do, with the group means 3.56 and 3.62 marked, and the test result in the title
GPA for the two groups. The boxes overlap almost completely.

The agent checked these two charts in the computer's own browser before it called them done. It found a title running off the edge and a legend sitting on top of some points, and fixed both.

We checked its numbers

The agent can be wrong and sound sure, so we did not take its table on trust. We opened a terminal on the computer and recomputed the headline figures from cleaned_survey.csv with a short command of our own:

The terminal: 117 rows; study hours count 96 mean 14.20 median 14.15; GPA count 104 mean 3.6 median 3.7; Pearson r = 0.45; AI users 56 with 3.62 and non-users 37 with 3.56; Welch p = 0.50
Our own recount. Every figure matched the agent's report.

The counts, means, medians, correlation and t-test all matched. We did not recheck the power figure or the adjusted comparison, so treat those two as the agent's word until you have.

The agent also checked itself. After writing REPORT.md, it compared the report with the program's actual output and corrected two mistakes: it had written 26 blanked cells when the log says 22, and it had said a test would need more than 1,000 students per group when its own calculation gave about 800. At the end it deleted every result and ran the whole pipeline again from the raw file. That found a real bug, since the analysis script assumed the charts folder already existed. It fixed it, so the next person can run the folder from scratch.

What to double-check

This is the agent's list, with our notes. It is a good checklist for any analysis an agent does for you:

  1. Is the data real? Ours was invented. Run the same scripts on your own file.
  2. The GPA scale. It assumed 0 to 4.0 and blanked anything above. If your university uses 0 to 5, 0 to 10 or percentages, it would delete valid top marks. The limit is one line in clean_survey.py.
  3. The judgement calls. A ceiling of 60 study hours and an age window of 17 to 60 are guesses. A mature student or a medical student in exam week would be removed by mistake.
  4. Duplicate detection is a heuristic. Read the removed rows in the log.
  5. "Sometimes" and "maybe" became missing, which can change the AI comparison. Consider three groups instead of two.
  6. What "used AI tools" meant on your questionnaire. The whole comparison rests on that question.
  7. The choice of test. It used Welch's t-test. Your supervisor may expect another one, and your methods chapter should say which you used.
  8. The ceiling at 4.00. Many students sit at the top mark, which weakens a correlation. The scatter chart shows the row of dots. Name it in your limitations.

Using your real file

Before you upload anything, check your ethics approval and consent form. Survey data about people may not be allowed to leave your university systems, and a cloud computer is outside them. Remove names, emails and student numbers first.

What it cost

The computer was on for about 14 minutes, most of it the agent working and the rest us checking. A Small computer is RM0.03 an hour, and the balance moved from RM0.98 to RM0.97. The Usage page shows each run, with its steps and the time it took. How running time and credit work has the details, and Small or Large helps you choose a size if your file is big.

Cautions

Keep reading

Getting started

Sign in with your Google account and open a chat on a Small computer. Paste the first message from this post, run it on the stand-in file first, then upload your own data once you trust the routine.

Open the workbench

Awi the cat agent celebrates with confetti

Awi, signing off.

← All posts