CSV#

Interface to read and write csv files.

Note

The module utilizes the csv file writer/reader from numpy.

class Source(location)[source]#

Bases: Source

CSV array source.

as_buffer()[source]#
as_memmap()[source]#
as_real()[source]#
as_virtual()[source]#

Return virtual source without array data to pass in parallel processing.

Returns

sourceSource class

The source class without array data.

property array#

The underlying data array.

Returns

arrayarray

The underlying data array of this source.

property dtype#

The data type of the source.

Returns

dtypedtype

The data type of the source.

property element_strides#

The strides of the array elements.

Returns

stridestuple

Strides of the array elements.

Note

The strides of the elements module itemsize instead of bytes.

property location#

The location where the data of the source is stored.

Returns

locationstr or None

Returns the location of the data source or None if this source lives in memory only.

property name#

The name of this source.

Returns

namestr

Name of this source.

property offset#

The offset of the memory map in the file.

Returns

offsetint

Offset of the memeory map in the file.

property order#

The order of how the data is stored in the source.

Returns

orderstr

Returns ‘C’ for C contigous and ‘F’ for fortran contigous, None otherwise.

property shape#

The shape of the source.

Returns

shapetuple

The shape of the source.

class VirtualSource(source=None, shape=None, dtype=None, order=None, location=None, name=None)[source]#

Bases: VirtualSource

as_buffer()[source]#
as_real()[source]#
as_virtual()[source]#

Return virtual source without array data to pass in parallel processing.

Returns

sourceSource class

The source class without array data.

property name#

The name of this source.

Returns

namestr

Name of this source.

create(location=None, shape=None, dtype=None, order=None, mode=None, array=None, as_source=True, **kwargs)[source]#
is_csv(source)[source]#

Checks if this source is a CSV source

read(source, slicing=None, as_source=None, **kwargs)[source]#

Read data from a csv file.

Arguments

sourcestr

The name of the CSV file.

slicingslice, Slice or None

An optional sub-slice to consider.

as_sourcebool

If True, return results as a source.

Returns

arrayarray

The data in the csv file as a buffer or source.

test()[source]#

Test CSV module

write(sink, data, slicing=None, **kwargs)[source]#

Write data to a csv file.

Arguments

sinkstr

The name of the CSV file.

dataarray

The data to write into the CSV file.

slicingslice, Slice or None

An optional sub-slice to consider.

Returns

sinkarray or source

The sink csv file.