Skip to content

header option eats extra line #2

@duffee

Description

@duffee

Using mtcars_001.csv file from csvkit_talk (a file that has one header line and 32 rows of data) and the perldl shell, I get

pdl> $cars = rcsv2D('mtcars_001.csv', {text2bad => 1, header => 0, debug => 1})                                  
Fetching 2D chunk=40000, reshape=80000, bad=?/1, sep_char=','
Initialized size=80000, cols=12, type=double
Reshaping to 33 (final)

and with the header option turned on, I get

pdl> $cars = rcsv2D('mtcars_001.csv', {text2bad => 1, header => 1, debug => 1})                                  
Fetching 2D chunk=40000, reshape=80000, bad=?/1, sep_char=','
Initialized size=80000, cols=12, type=double
Reshaping to 31 (final)

which skips the first row of data. The same thing happens for higher values in that one more line than specified is skipped. Setting the value of header to either -1 or 0.5 fixes the problem

pdl> $cars = rcsv2D('mtcars_001.csv', {text2bad => 1, header => -1, debug => 1})                                 
Fetching 2D chunk=40000, reshape=80000, bad=?/1, sep_char=','
Initialized size=80000, cols=12, type=double
Reshaping to 32 (final)

version info:

  • PDL::IO::CSV v0.010
  • PDL v2.019 (supports bad values)
  • perlDL shell v1.357
  • perl v5.26.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions