Diagnosing a Python KeyError in an Excel-Exported CSVDiagnosing a Python KeyError in an Excel-Exported CSV
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started
Quick puzzle for anyone who works with Python and Excel.
A script reads a CSV exported from Excel. It stops with KeyError: 'date'. You open the file, and the first column is called "date".
What's your first guess?
A) A typo in the code
B) Something hidden in the file
Answer in my next post.
A) Typo in the code
B) Something hidden

2 votes

Ends in 8h

Ahmar's avatar
Definitely B! Classic invisible BOM character at the start of an Excel CSV export.
Eros's avatar
Good eye, Ahmar! I'll keep the full answer for my next post, so others can still guess. Have you hit this one in a real project?
Israel's avatar
Fun puzzle! Excel exports always have a surprise or two.
Eros's avatar
Thanks, Israel! They really do, and this one doesn't even show when you open the file.
Back to feed
The network for creativity
Join 1.25M professional creatives like you
Connect with clients, get discovered, and run your business 100% commission-free
Creatives on Contra have earned over $150M and we are just getting started