# Decoders

## .qsp.decode.csv¶

Decodes CSV data from strings or bytes with delimiter separated values into tables or matrices of data with desired data types.

Signatures:

.qsp.decode.csv[schema; delimiter]

- schema      - Desired schema of output data. The schema object can be represented
as a table with the desired output columns. Optionally, the schema
can simply be a list of types to support as type characters.
- [delimiter] - The delimiter character is the field separator for the records in
the encoded data. This field is optional and will default to a
comma.
.qsp.decode.csv[opts]

- opts.schema     - Desired schema of output data. The schema object can be represented
as a table with the desired output columns. Optionally, the schema
can simply be a list of types to support as type characters.
- opts.delimiter  - Record delimiter for values in the delimited file. This value
defaults to a comma if not provided.
- opts.header     - Indicates if the data to be decoded has a header or not. A header is
a single record at the top of the delimited data indicating column
names for the data. Valid options include  always  if
the data has a header.  If the data does not have a header
 none  can be provided. By default it is assumed data
- opts.exclude    - A symbol list of column names or indices of the columns to ignore
when decoding the data.

Example: CSV Decode from a File

// Generate a random table of data and store it in an inventory file.
n: 10000;
t: ([]
date: n?.z.d + neg til 10;
price: (n?1000)div 100;
item: n?3;
description: {rand[100]?.Q.an}each til n;
quantity: n?10000);
:/tmp/inventory.csv 0: csv 0: t;

// Read and parse the data from a file
schema: ([] date: date$(); price:int$(); item:symbol$(); description: (); quantity:long$());
.qsp.run