Urgent.News

What's breaking now, across thousands of outlets.

Tech

Two CSV exports, one schema, and a rejected-row log

Two order exports contained the same fields in different column orders. The first also had a blank customer name. The second had a row with an extra field. I used those four synthetic rows to test a small Python script that separates usable rows from rows a person needs to review. Input The east export puts the order ID first. Order,Name,Region 001,"Lee, Jordan",East 002, ,East The west export…

Two CSV exports were compared, despite sharing the same schema but with differing column orders. The first export featured a blank customer name, while the second contained a row with an extra field. A Python script was employed to separate valid rows from those requiring review. The script first resolved the headers of each file independently and mapped them to their respective columns.

The destination column order was derived from this mapping. The script then extracted and stripped values from each row according to the established positions. Upon running the script, two rows were deemed acceptable, while two others were flagged for review. The consolidated CSV file contained the accepted rows, with the rejected rows identified along with their source file, line number, and reason for rejection.

The script also prevented the overwriting of existing output directories and confirmed that it could handle UTF-8 CSV files with small local datasets.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Five-minute deploys across 25 projects with a core team of three

An hour-long deploy doesn't cost you an hour. It costs you every deploy you decide not to do. At Blanco Brand a deploy used to take an hour. Now it takes five minutes.

  • Blanco Brand achieves five-minute deploys with three developers
  • Platform manages 25 projects on DigitalOcean
  • Deployment costs reduced 63% for infrastructure, 55% for development

OpenSparrow v4.7 adds a theme toggle, My history panel and nine new UI locale

OpenSparrow v4.7 brings a light / dark / system theme, a "My history" panel with your recent record clicks, a Files tab that only appears where it makes sense, and nine new languages (29 in total)…

  • OpenSparrow v4.7 introduces theme toggle with light, dark, and system themes
  • My history panel added for users to view recent clicks
  • Nine new languages added, bringing total to 29 languages

More from Thursday 19 November →