Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing whitespace in data fields #120

Closed
gizmaa opened this issue Nov 28, 2017 · 3 comments
Closed

Trailing whitespace in data fields #120

gizmaa opened this issue Nov 28, 2017 · 3 comments

Comments

@gizmaa
Copy link

gizmaa commented Nov 28, 2017

Data fields with spaces as delimiters and spaces at the end of each line generate an extra, entirely #NULL, column.

Example Data:

11/16/2017 09:29:38 34178.180 3593669378.197 8:29:38� SPEC:NH3
3593669378.087130 1.743859e0 
3593669378.187050 1.562473e0 
3593669378.287150 1.018122e0 
3593669378.387250 6.525061e-1 
3593669378.487160 7.634536e-1 
3593669378.587080 2.136079e0 

Between the pairs of values are single spaces and at the end of each line are also single spaces.

Example Code:

D = CSV.read(src;delim=' ',header=["Time","NH3","Empty"],datarow=2)

Related past issues:
#84
#3

@quinnj
Copy link
Member

quinnj commented Jan 6, 2018

I'm not sure I understand the issue here; if there's a trailing ' ' after the last column, that's standard CSV notation for "include an entirely empty column". That is, the last column in a CSV file should just end w/ a '\n' character, not w/ another delimiter.

Am I missing something?

@gizmaa
Copy link
Author

gizmaa commented Jan 8, 2018

The question should probably be better formulated: Can an option be added to ignore the last/arbitrary column to compensate for oddly formatted files?

I know for sure the example above is only two columns. In another file type by the same manufacturer they use a comma delimiter and still have the occasional space tossed in after certain columns' values but since the delimiter is a comma it doesn't matter.

3528489623.488570 ,312.73,0.00,41.87425,297.63020,0.00000,286.34230,-99.99000,-99.99000,12716,0,0,0,,-24.81942,853.80730,0.00000,.000 ,6.007e1 ,132.356 
3528489624.488660 ,312.49,0.00,41.87623,297.63420,0.00000,286.35630,-99.99000,-99.99000,12716,0,0,0,,-24.82060,852.19210,0.00000,.000 ,3.827e1 ,132.356 
3528489625.488570 ,312.74,0.00,41.87155,297.63270,0.00000,286.37230,-99.99000,-99.99000,12716,0,0,0,,-24.82111,853.42570,0.00000,.000 ,6.138e1 ,132.356 
3528489626.488660 ,312.49,0.00,41.86422,297.63200,0.00000,286.38370,-99.99000,-99.99000,12716,0,0,0,,-24.82091,854.13420,0.00000,.000 ,4.923e1 ,132.356 
3528489627.488750 ,312.62,0.00,41.87615,297.63240,0.00000,286.39700,-99.99000,-99.99000,12716,0,0,0,,-24.82035,851.17100,0.00000,.000 ,4.249e1 ,132.356 

@quinnj
Copy link
Member

quinnj commented Aug 23, 2018

We now strip trailing whitespace by default (on current master).

@quinnj quinnj closed this as completed Aug 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants