Library › Data AI › Operations and supply chain

Split a messy address column into a clean CSV block

  • For Operations and supply chain
  • You practice Showing an example of what you want
  • Time about 5 minutes
  • Level Intermediate

About this exercise

A shipping export has one address column and you need separate fields. Write one CSV block (one code block) with the header original,street,city,state,zip and one row per address in the same order. Keep apartment numbers in street, write the ZIP as 5 digits, and leave a field empty if the address doesn't contain it. At most 12 words outside the code. Wrap cells that contain commas in double quotes.

Common mistakes when you ask AI for this

  • Guessing the ZIP. The AI invents a ZIP for Springfield and pads the 4-digit one. Try: Add: "If a ZIP is missing or incomplete, leave zip empty. Don't guess."
  • Dropping apartment numbers. The AI moves Apt 3 into its own column or drops it. Try: Add: "Keep Apt or Unit in street."
  • Broken CSV quoting. Unquoted commas in the original shift every column. Try: Add: "Put the original in double quotes. 6 rows in the same order."
  • Leaving the format to chance. The AI picks its own length and layout unless told the exact shape. Try: Add: "Put the code in exactly 1 code block. Keep the writing outside the code under 12 words."

What a strong prompt includes

  • Asks for the header
  • Keeps units in street
  • Handles ZIP+4
  • Says no guessing
  • Gives the quoting rule

Practice this now ↑

Related exercises