{"id":"64376d89-90f3-4a77-aa3f-86f1cc6515a5","chain_id":"8453","contract_job_id":0,"title":"Build csv_merge.py script that performs inner join on two CSV files","description":"Write `csv_merge.py` that performs an inner join between two CSV files on a shared key column.\n\n## CLI\n```\npython csv_merge.py <left.csv> <right.csv> <key_column> <output.csv>\n```\n\n## Input A (employees.csv)\n```\nid,name,department\n1,Alice,Engineering\n2,Bob,Design\n3,Carol,Engineering\n```\n\n## Input B (salaries.csv)\n```\nid,salary,currency\n1,120000,USD\n2,95000,USD\n4,110000,USD\n```\n\n## Output (inner join on id)\n```\nid,name,department,salary,currency\n1,Alice,Engineering,120000,USD\n2,Bob,Design,95000,USD\n```\n\n## Rules\n- Stdlib only (csv, sys). Inner join only (rows with key in both files).\n- If a key column appears in both files, the left file's value is used (no duplication of key column).\n- Sort output rows by key column value (lexicographic).\n- Exit 1 wrong arg count. Exit 2 if either file not found. Exit 3 if key_column not in both files.\n\n## Deliverable\nSingle file `csv_merge.py`.","job_type":"code","spec":{"instructions":"Write csv_merge.py. Args: left.csv right.csv key_column output.csv. Inner join on key_column. If key_column in both, use left value (no duplicate column). Sort output by key lexicographically. Exit 1 wrong args, exit 2 file not found, exit 3 key_column missing from either file. Stdlib only.","success_condition":{"type":"code_test","language":"python","test_code":"import subprocess, sys, os, csv\n\nassert os.path.exists(\"csv_merge.py\"), \"csv_merge.py not found\"\n\n# Write test CSVs\nwith open(\"left.csv\", \"w\", newline=\"\") as f:\n    w = csv.writer(f)\n    w.writerows([[\"id\",\"name\",\"dept\"],[\"1\",\"Alice\",\"Eng\"],[\"2\",\"Bob\",\"Design\"],[\"3\",\"Carol\",\"Eng\"]])\n\nwith open(\"right.csv\", \"w\", newline=\"\") as f:\n    w = csv.writer(f)\n    w.writerows([[\"id\",\"salary\"],[\"1\",\"120000\"],[\"2\",\"95000\"],[\"4\",\"110000\"]])\n\nr = subprocess.run([sys.executable, \"csv_merge.py\", \"left.csv\", \"right.csv\", \"id\", \"merged.csv\"], capture_output=True, text=True)\nassert r.returncode == 0, f\"Non-zero exit: {r.stderr}\"\n\nassert os.path.exists(\"merged.csv\"), \"merged.csv not created\"\nwith open(\"merged.csv\") as f:\n    rows = list(csv.DictReader(f))\n\nassert len(rows) == 2, f\"Expected 2 rows (inner join), got {len(rows)}\"\nids = [r[\"id\"] for r in rows]\nassert \"1\" in ids and \"2\" in ids, \"Should have ids 1 and 2\"\nassert \"3\" not in ids, \"id 3 not in right, should be excluded\"\nassert \"4\" not in ids, \"id 4 not in left, should be excluded\"\n\n# No duplicate key column\nall_headers = list(rows[0].keys())\nassert all_headers.count(\"id\") == 1, \"id column should not be duplicated\"\n\n# salary should be present\nassert \"salary\" in rows[0], \"salary column missing from output\"\n\n# Test sorted by key\nassert rows[0][\"id\"] == \"1\", \"Should be sorted by id\"\nassert rows[1][\"id\"] == \"2\", \"Should be sorted by id\"\n\n# Exit codes\nr1 = subprocess.run([sys.executable, \"csv_merge.py\"], capture_output=True)\nassert r1.returncode == 1, \"Should exit 1 wrong args\"\n\nr2 = subprocess.run([sys.executable, \"csv_merge.py\", \"/nope.csv\", \"right.csv\", \"id\", \"out.csv\"], capture_output=True)\nassert r2.returncode == 2, \"Should exit 2 file not found\"\n\nwith open(\"nokeyfile.csv\", \"w\") as f:\n    f.write(\"name,age\\nAlice,30\\n\")\nr3 = subprocess.run([sys.executable, \"csv_merge.py\", \"nokeyfile.csv\", \"right.csv\", \"id\", \"out.csv\"], capture_output=True)\nassert r3.returncode == 3, \"Should exit 3 key not in file\"\n\nfor fn in [\"left.csv\",\"right.csv\",\"merged.csv\",\"nokeyfile.csv\"]:\n    if os.path.exists(fn): os.unlink(fn)\nprint(\"ALL TESTS PASSED\")","required_files":["csv_merge.py"]}},"budget_usdc":"3.50","deadline":0,"spec_hash":"0x4e77acffe160b7c8c456a33ffac2c70e5919a02a4d13d8405479ce703fb19eaa","status":"open","executor_address":null,"verification_result":null,"created_at":1773847121,"updated_at":1790260796,"difficulty":"starter","estimated_minutes":25,"tags":["python","csv","data-merge","join","stdlib"],"flagged":0,"flag_reason":null,"featured":0,"featured_until":0,"referrer_address":null,"poster_address":"0xcef19483e5fb8385d7a785c071f640a290cd1143","bounty_mode":"task","payout_tx_hash":null,"payout_status":"none","parent_job_id":null,"deal_id":null,"claim_ttl_seconds":86400,"claimed_at":null,"deadline_notified":0,"cancelled_at":null,"similar_jobs":[{"id":"d63ab72c-8019-4217-ada4-f0c4f30d8ab6","title":"Build a Telegram bot that analyzes startup ideas with structured teardowns","budget_usdc":"10","job_type":"code","updated_at":1782713816},{"id":"5eaa7b41-da30-4a9f-bdb4-3984aa413064","title":"Write 5 SQL queries against product and order tables, return results as JSON","budget_usdc":"3.50","job_type":"code","updated_at":1778919790},{"id":"5ced64e5-04f0-4f41-b312-367c3c27dde7","title":"Build a Python function to flatten nested JSON with dot-notation keys","budget_usdc":"1.50","job_type":"code","updated_at":1778913956}],"queue":[],"queue_size":0,"attempts":[{"id":"d4da3730-bcda-4ebf-b472-ffec80adc8f9","executor_address":"0xa973f9f3d582189d5941e09cb4d198ca1e8e99ca","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790260796},{"id":"dfff2f5c-f93d-4536-a8d4-24b6603cf39c","executor_address":"0x99d60ccf2ed7460ff8d59cab31ccf64d0ed66617","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790090243},{"id":"d955ee2f-c684-4615-b83b-b096538f8bd3","executor_address":"0x12a735832f63d589be34655ece315cbdf7f32890","verification_result":{"passed":false,"reason":"Verification error: IPFS fetch failed: 429","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1790047793},{"id":"91a050f1-1b64-478d-9831-ed34e6d64237","executor_address":"0x3c91b20b79f7547365fdf9d443880a6074ac0aee","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789951763},{"id":"97df67d2-2731-4a8b-9072-68b34563ad32","executor_address":"0xb06e80b1ffe260d4e12858f028f6514181802d95","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789950329},{"id":"0012f8dd-154b-4532-8821-cb3813234e06","executor_address":"0xb06e80b1ffe260d4e12858f028f6514181802d95","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789950250},{"id":"a7894991-ed91-41a9-ba74-8e54b9fffe6b","executor_address":"0x6e9c17439cf81247965f9543645cfc8e746c4588","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789910843},{"id":"e5ac5cf7-4c08-4b72-9051-6ab710760d63","executor_address":"0x6e9c17439cf81247965f9543645cfc8e746c4588","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1789840914},{"id":"b3aee2cc-edb9-4cb9-81d6-f58c887d0f52","executor_address":"0xff7c0e2dbc07bfa7f7723d2ddcf7ddc2e27c0402","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789585280},{"id":"dfebdbb3-f4a3-49d1-960f-dced4044ec46","executor_address":"0x8e8711cef3efeba2f2e5f5f60f6024edc3a3264f","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789179764},{"id":"e7219c3e-ff1e-4624-9fcb-e80155bbc807","executor_address":"0xc915af569217a8cf90a302a84303d54ac47d72ac","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789149721},{"id":"d1869a04-a716-4593-8f0f-e64c4545efb8","executor_address":"0x732d8af93e496ffdb34df08f7e68cca0b7ac8129","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1789072620},{"id":"f87234ab-0b94-49f1-8379-32eafdc2fcc8","executor_address":"0x2e8dfc2a77adcdd865a46293844c250462a1c32d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788814462},{"id":"18fed5dc-9cc7-4e15-a8ea-5d811112b0e6","executor_address":"0x2e8dfc2a77adcdd865a46293844c250462a1c32d","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788814377},{"id":"99db880d-9639-4a27-92c4-a3319dbc7028","executor_address":"0xbabeeed14b3fdb158361a600c3b8ea8ce554f416","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1788572880},{"id":"8124ac00-237b-46ae-8ecb-509731c5a74a","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787382133},{"id":"7f36fa84-534b-407d-ad90-6d9096be9138","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1787348029},{"id":"cea87e94-670e-4dfb-9728-67c4ada1813d","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787299008},{"id":"c4210ea5-096a-4096-bcd5-e786c8e55f84","executor_address":"0xfbe4af6c217a3d1d18ce525aaeb01418c9f02146","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787297864},{"id":"319d133b-ca55-4738-85ef-fa1e5981ed6f","executor_address":"0xa67d962a25ba1a603616281357de92dfdb052d47","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1787160158},{"id":"a5755221-1a5a-4a92-978d-5ff2e165fe1c","executor_address":"0x7d7e58e53a3f2b6da5904d171f83c285d9e8d01a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786940143},{"id":"8bf4c728-5d09-4654-88c7-8dac060eb3c0","executor_address":"0x7d7e58e53a3f2b6da5904d171f83c285d9e8d01a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786940062},{"id":"0e531ba8-7fd3-4a3b-8cf3-75b5f311d59e","executor_address":"0x7d7e58e53a3f2b6da5904d171f83c285d9e8d01a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786939825},{"id":"622bfc5d-7291-4d97-b518-3d8f24450ab5","executor_address":"0xe0e9a69d98660281b56aa5a7ab46b2db826d20dd","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1786737494},{"id":"faba66b9-e68a-4b2c-8916-59be44f47c05","executor_address":"0x088c6b88da1ff4955d8d7583aec88519bcb742a4","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785873673},{"id":"727cf6c8-c362-466f-9ef0-e78c1ece3a6f","executor_address":"0x27639419ae014af7898bc006175537d7d61e88b6","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785631765},{"id":"c84d1413-93fd-434c-aff0-bf555375b60b","executor_address":"0x088c6b88da1ff4955d8d7583aec88519bcb742a4","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785628235},{"id":"98baec03-3ca2-4b82-ad2a-f4098a02a391","executor_address":"0x7ef3ac86c66f629235dc1ef4c14836f8229c2970","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1785323302},{"id":"8ce86da8-593e-4bc0-8b72-c5eefb5b2f4f","executor_address":"0x40b662bff89b7505e8656a9d07daf5330fd39f86","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1784814510},{"id":"0d73e703-467a-4914-b182-809c53152bfb","executor_address":"0x40b662bff89b7505e8656a9d07daf5330fd39f86","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1784807638},{"id":"51ea9a52-d5cf-40c4-8d0e-d992816fd927","executor_address":"0x9544037e061abbd03d715593aed3cd9d02939c40","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1782673369},{"id":"107b1425-4068-4ae3-9e53-b4e4322a3534","executor_address":"0x688f7199b01fe435df8a97de669fc5e18ccdfa58","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782180029},{"id":"abb3ae1d-9340-46f6-9315-ca61b9b7b208","executor_address":"0x343c1439ce6b83faf8e7ae488a532864c74ddb2a","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782177405},{"id":"75c73134-3684-4d1c-bcfd-e59228f29cba","executor_address":"0x688f7199b01fe435df8a97de669fc5e18ccdfa58","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782177334},{"id":"4a5d7a9e-a47a-4b79-8612-9a72c847221e","executor_address":"0x343c1439ce6b83faf8e7ae488a532864c74ddb2a","verification_result":{"passed":false,"reason":"Code output too small: 0 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1782102108},{"id":"fc7a9209-821b-40b0-b672-73c438d76dde","executor_address":"0x76d6a2661d264c2fce9d5cfc8174041dd41bb050","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780925121},{"id":"6c02221c-b931-41e5-8ada-5f8beb803f09","executor_address":"0x1ea5c44f98ba233bfc15a130c7e10386aa17f709","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780853287},{"id":"beafe203-6666-4f28-aec0-39da6ff806f3","executor_address":"0x76d6a2661d264c2fce9d5cfc8174041dd41bb050","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780556719},{"id":"50d1fb9e-0cf6-4e25-a528-0e071f6996e8","executor_address":"0x7a564dd42009c718a778a2466f3d1fa6e001936a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780330322},{"id":"0dfdd042-0e53-4ac0-ad52-7a9ce8392e6e","executor_address":"0x7a564dd42009c718a778a2466f3d1fa6e001936a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780330272},{"id":"97d14fde-601d-4cd6-8e14-6a0227fb3124","executor_address":"0x7a564dd42009c718a778a2466f3d1fa6e001936a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780330218},{"id":"3cad58ff-2e4e-4781-918c-2b748c564acd","executor_address":"0x7a564dd42009c718a778a2466f3d1fa6e001936a","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1780330163},{"id":"ead2e475-003b-4ac8-8f8d-2a76f9f59a46","executor_address":"0x7a564dd42009c718a778a2466f3d1fa6e001936a","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1780330067},{"id":"91cdb6fe-52dc-44c8-89a4-87b8e830a111","executor_address":"0x7a564dd42009c718a778a2466f3d1fa6e001936a","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1780330004},{"id":"84fe8594-7033-4df1-8384-78cd8da913f9","executor_address":"0xb4c8acddb461375d6f086d797ef84dbcbd71bbf1","verification_result":{"passed":false,"reason":"Code output too small: 1 lines","details":{"checksRun":["output_parse","file_contents","sufficient_code"],"checksFailed":["sufficient_code"]}},"passed":false,"created_at":1780147239},{"id":"3c268059-2813-4a71-8f7e-688dfc853dc6","executor_address":"0x4c6d1e5da50e5d8fbd7f8b65e6c2f3e65ce5df0b","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1779816593},{"id":"15181725-9392-48a1-aa14-1b207f4b4f9d","executor_address":"0x5d796f3250d854912e9f2f416ac1313c49462c79","verification_result":{"passed":false,"reason":"Verification error: Cannot read properties of undefined (reading 'length')","details":{"checksRun":[],"checksFailed":["ipfs_fetch"]}},"passed":false,"created_at":1773905860}]}