Ask AI for a Data-Cleaning Plan Before Changing a CSV

AI TutorialsBy QueryFun3 min read
On this page
  1. Start with a small, clear example
  2. Try this prompt
  3. Work through the result
  4. Catch the common mistakes
  5. Check before you reuse it
  6. Try it yourself

Data cleaning is a series of decisions, not a button that makes every value correct. AI can help identify patterns and propose a plan. Before changing a CSV, define what each field means and which corrections can be justified from evidence.

Practice time: About 15 minutes. Use any text-based AI assistant you already have access to. Interface names and available tools vary. The examples below are fictional, and you do not need a paid plan or private information to practise.

Start with a small, clear example

Use fictional rows with columns CustomerID, Name and City. Two rows share CustomerID 1 and the same name, one city has trailing spaces, and another record has an empty city. Repeated names alone are not enough to prove that two different IDs are duplicates.

Try this prompt

Copy the following into your assistant. Keep the sample input attached to the request so the task can be understood without guessing. Treat the response as a draft to inspect, not as a finished answer simply because it sounds confident.

Propose a cleaning plan for this fictional CSV. Keep the original unchanged. Identify exact duplicate rows, repeated IDs, whitespace issues and missing values separately. Explain which changes can be automated and which require a decision. Do not fill missing cities from guesses about a person's name. Provide before-and-after validation checks.

Work through the result

Start with a copy and a record count. Ask the assistant to state the duplicate rule explicitly: exact duplicate rows, repeated IDs and repeated names are different cases. Two customers can share a name.

Trimming surrounding spaces from a category label may be justified when the field definition supports it. Filling a missing city is different because the correct value is unknown. Mark it for review rather than choosing the most common city automatically.

Record every removed or changed row in a change log. After cleaning, reconcile the counts: original rows minus removed duplicates should equal remaining rows. Check that IDs and amounts have not shifted between records.

Catch the common mistakes

Do not upload confidential records merely because a tool accepts files. For this exercise, use fictional data. Also beware of CSV identifiers such as 0012 that may be converted to numbers by a spreadsheet program. Decide which columns should remain text before opening or exporting the file.

Check before you reuse it

Compare the response with your original input. Look for a missing condition, a changed number and any information the assistant added without support. Read names, dates and instructions particularly carefully. If the task involves an action, distinguish a suggested action from one you have actually completed.

Revise one specific weakness at a time. A follow-up such as “keep the uncertain date marked unconfirmed” gives a clearer correction than “make it better.” Keep the useful parts and check the revised passage again. An improved format does not guarantee improved accuracy.

Try it yourself

The original file has 10 rows. You remove two confirmed exact duplicate rows and mark one missing city for review without deleting its record. How many rows should the cleaned file contain?

Check your answer

The cleaned file should contain 8 rows. Marking a missing value does not remove the record. The log should explain the two removals and the unresolved city. If the file contains 7 rows, investigate an unintended deletion before using the cleaned data.

Keep exploring: AI learning path.

Leave a Reply

Your email address will not be published. Required fields are marked *