<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.steps.loaders.CSVLoader.html -->
# CSVLoader

**`class CSVLoader(config)`**

Bases: [`Loader`](squirro.lib.nlp.steps.loaders.Loader.md#squirro.lib.nlp.steps.loaders.Loader)

The CSV [`Loader`](squirro.lib.nlp.steps.loaders.Loader.md#squirro.lib.nlp.steps.loaders.Loader) loads CSV files and transforms the data into [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) items.

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – csv
- `delimiter` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``'``,``'`) – delimiter between fields
- `encoding` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``'utf-8'`) – given file’s encoding
- `quotechar` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)`, ``'"'`) – character used around values to quote them
- `replace_new_lines` ([`bool`](https://docs.python.org/3.11/library/functions.html#bool)`, ``True`) – indicates if replacement of new lines characters is applied

**Example**

```json
{
    "step": "loader",
    "type": "csv",
    "fields": [ "text", "label" ]
}
```

Methods SummaryMethods Documentation

**`process(directory)`**

Process a directory of csv files and yield documents.

Parameters

`directory` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – path to directory with *.csv files

Returns

Generator of Documents read from CSV

Return type

generator([Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document))
