NAME

PDL::IO::CSV - Create PDL from CSV file (optimized for speed and large data)

SYNOPSIS

my $pdl = rcsv2D($csv_filename_or_filehandle);
#or
my $pdl = rcsv2D($csv_filename_or_filehandle, \@column_ids);
#or
my $pdl = rcsv2D($csv_filename_or_filehandle, \%options);
#or
my $pdl = rcsv2D($csv_filename_or_filehandle, \@column_ids, \%options);

DESCRIPTION

The traditionall way of creating PDL piddle from CSV data is via rcols function.

my $pdl = rcols("data.csv", [1..4], { DEFTYPE=>double, COLSEP=>"," });

This module provides alternative implementation based Text::CSV_XS which should be significantly faster than traditional approach.

FUNCTIONS

rcsv1D

Loads data from CSV file into 1D piddles (separate for each column).

my ($pdl1, $pdl2, $pdl3) = rcsv1D($csv_filename_or_filehandle);
#or
my ($pdl1, $pdl2, $pdl3) = rcsv1D($csv_filename_or_filehandle, \@column_ids);
#or
my ($pdl1, $pdl2, $pdl3) = rcsv1D($csv_filename_or_filehandle, \%options);
#or
my ($pdl1, $pdl2, $pdl3) = rcsv1D($csv_filename_or_filehandle, \@column_ids, \%options);

Items supported in options hash:

rcsv2D

Loads data from CSV file into 2D piddle.

my $pdl = rcsv2D($csv_filename_or_filehandle);
#or
my $pdl = rcsv2D($csv_filename_or_filehandle, \@column_ids);
#or
my $pdl = rcsv2D($csv_filename_or_filehandle, \%options);
#or
my $pdl = rcsv2D($csv_filename_or_filehandle, \@column_ids, \%options);

Items supported in options hash are the same as by "rcsv1D".

wcsv1D

Saves data from one or more 1D piddles to CSV file.

wcsv1D($pdl1, $pdl2, $pdl3, $csv_filename_or_filehandle, \%options);
#or
wcsv1D($pdl1, $pdl2, $pdl3, $csv_filename_or_filehandle);
#or
wcsv1D($pdl1, $pdl2, \%options); #prints to STDOUT
#or
wcsv1D($pdl1, $pdl2);

# but also
$pdl1D->wcsv1D("file.csv");

Items supported in options hash:

wcsv2D

Saves data from one 2D piddle to CSV file.

wcsv2D($pdl, $csv_filename_or_filehandle, \%options);
#or
wcsv2D($pdl, $csv_filename_or_filehandle);
#or
wcsv2D($pdl, \%options); #prints to STDOUT
#or
wcsv2D($pdl);

# but also
$pdl->wcsv2D("file.csv");

Items supported in options hash are the same as by "wcsv1D".

SEE ALSO

PDL, Text::CSV_XS

LICENSE

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

COPYRIGHT

2014+ KMX kmx@cpan.org