question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trim whitespace in csv headers

See original GitHub issue

Sometimes the headers include whitespace like

a, b , c,  d
1, 2 ,3 , 4

In these cases they shouldn’t be parsed as ' b' but be ' b'.trim() instead.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:6

github_iconTop GitHub Comments

2reactions
dmlukichevcommented, Dec 25, 2017

@henningBunk: data['Issue ID'] doesn’t look very pretty, but solves your problem 😃

2reactions
dmlukichevcommented, Nov 14, 2016

It would be even better if we could specify transform function for headers. For instance, I have report with following headers: [‘Ship To - Country’, ‘Ship To - State’, ‘Ship To - City’]. But I need: [‘country’, ‘state’, ‘city’]. I can pass a function that will erase 'Ship To - ’ part and lowercase the rest.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to remove extra spaces in CSV header - Stack Overflow
replace and with are used together to search the string (key), in our case for space (" ") and replace it with empty...
Read more >
How to remove trailing whitespaces from column headers in ...
First, let's create some dummy data. You can see that the first column has a trailing whitespace, while the second one has a...
Read more >
CSV headers with extra space don't get mapped to correct fields
I think trimming the CSV source columns when entering them in the user interface is a good idea. Trimming the CSV column names...
Read more >
CSV Parse - Option trim
The trim option ignore whitespace characters immediately around the delimiter. Defaults to false . It does not remove whitespace present inside the quotes ......
Read more >
csv::Trim - Rust - Docs.rs
The whitespace preservation behaviour when reading CSV data. Variants. None. [−] Expand description. Preserves fields and headers. This ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found