mafintosh / mafintosh/csv-parser
Column headers with the non unique names are replacing each other
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 143
- PR merge metrics
- No merged PRs in 30d
Description
* Operating System: Windows
* Node Version: v16.15.0
* NPM Version: 8.5.5
* csv-parser Version: I'm using neat-csv version 7.0.0
### Expected Behavior
```
const csv = 'type,part,part\nunicorn,horn,eye\nrainbow,pink,tail';
console.log(await neatCsv(csv)); // [{type: 'unicorn', part: 'horn', part_1: 'eye'}, {type: 'rainbow', part: 'pink', part: 'tail'}]
```
When importing a CSV file with non unique header names into Excel it will add `_#`. In this example it will create the following headers: `type | part | part_1`
### Actual Behavior
```
const csv = 'type,part,part\nunicorn,horn,eye\nrainbow,pink,tail';
console.log(await neatCsv(csv)); // [{type: 'unicorn', part: 'eye'}, {type: 'rainbow', part: 'tail'}]
```
It looks like it overrides the previous column with the same header name.
### How Do We Reproduce?
Use the examples from above or see this sandbox
https://codesandbox.io/s/read-file-node-ejs-forked-pqmqrm?file=/src/index.js
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the duplicate-header CSV examples in the issue and compare the current output with the expected part and part_1 fields. Use the linked CodeSandbox to reproduce the behavior; done means repeated headers are preserved with suffixed names and all row values remain available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100