# Python CSV libraries

Python CSV libraries read comma-separated files into rows or tables and write data back out as CSV. A dataframe library parses the whole file into typed columns rather than returning one row at a time. These libraries let data pipelines and analytics apps load exports and logs saved as CSV.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [pandas](#pandas) | 710.3M | 49.6K | Nov 2026 | BSD-3-Clause |
| [pyarrow](#pyarrow) | 437.8M | 17.3K | Nov 2026 | Apache-2.0 |
| [DuckDB](#duckdb) | 81.2M | 206 | Oct 2026 | MIT |
| [Polars](#polars) | 68.7M | 40.3K | Oct 2026 | MIT |
| [Dask](#dask) | 31.6M | 14.0K | Aug 2026 | BSD-3-Clause |
| [Tablib](#tablib) | 5.8M | 4.8K | Jul 2026 | MIT |
| [CleverCSV](#clevercsv) | 1.1M | 1.3K | May 2026 | MIT |
| [petl](#petl) | 1.1M | 1.3K | Nov 2026 | MIT |

Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

[pandas](#pandas) has the most monthly downloads among the registry packages in this comparison, at 710.3M.

## Capabilities

| Library | CSV type inference | Chunked CSV reading |
| --- | --- | --- |
| [pandas](#pandas) | Yes | Yes |
| [pyarrow](#pyarrow) | Yes | Yes |
| [DuckDB](#duckdb) | Yes | Yes |
| [Polars](#polars) | Yes | Yes |
| [Dask](#dask) | Yes | Yes |
| [Tablib](#tablib) | No | No |
| [CleverCSV](#clevercsv) | Via plugin | Yes |
| [petl](#petl) | No | Yes |

## Libraries

### pandas

[GitHub](https://github.com/pandas-dev/pandas) · [PyPI](https://pypi.org/project/pandas) · [Docs](https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html)

Reads CSV data into a DataFrame with configurable parsing and conversion.

- Downloads / mo: 710.3M
- Stars: 49.6K
- Last release: 3.1.1
- License: BSD-3-Clause
- Capabilities: [From the pandas docs](https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html)

**Strengths**

- **Controls column types and conversion.** Set dtype, converters, and missing-value rules for each input.
- **Returns configurable row chunks.** Use chunksize or iterator when processing a CSV incrementally.

**Watch out for**

- **Low-memory mode still returns everything.** Set chunksize or iterator when rows must be processed incrementally.

```sh
pip install pandas
```

**kedro-org/kedro-plugins** (121 stars)

[kedro-org/kedro-plugins](https://github.com/kedro-org/kedro-plugins) 

```python
def load(self) -> pd.DataFrame:
    load_path = str(self._get_load_path())
    if self._protocol == "file":
        # file:// protocol seems to misbehave on Windows
        # (<urlopen error file not on local host>),
        # so we don't join that back to the filepath;
        # storage_options also don't work with local paths
        return pd.read_csv(load_path, **self._load_args)

    load_path = f"{self._protocol}{PROTOCOL_DELIMITER}{load_path}"
    return pd.read_csv(
        load_path, storage_options=self._storage_options, **self._load_args
    )

```

[kedro-datasets/kedro_datasets/pandas/csv_dataset.py](https://github.com/kedro-org/kedro-plugins/blob/f2516d069e6930c5dd3e1598642e736d7e66fa5f/kedro-datasets/kedro_datasets/pandas/csv_dataset.py#L178-L190) · [More projects using pandas →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20pandas%20for%20typed%20CSV%20imports%2C%20incremental%20processing%2C%20schema%20overrides%20and%20CSV%20export&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import pandas as pd
from io import StringIO
frame = pd.read_csv(StringIO("name,score\nAda,9\n"))

```

From [io.html](https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html)

### pyarrow

[GitHub](https://github.com/apache/arrow) · [PyPI](https://pypi.org/project/pyarrow) · [Docs](https://arrow.apache.org/docs/python/csv.html)

Reads and writes columnar Arrow data in CSV format.

- Downloads / mo: 437.8M
- Stars: 17.3K
- Last release: 26.0.1
- License: Apache-2.0
- Capabilities: [From the pyarrow docs](https://arrow.apache.org/docs/python/csv.html)

**Strengths**

- **Supports multithreaded bulk parsing.** Use the bulk reader when parallel CSV parsing suits the workload.
- **Declares conversion types explicitly.** Provide column_types when inferred types would change identifiers or numeric values.

**Watch out for**

- **Incremental reads use one thread.** Use read_csv when parallel bulk parsing matters more than incremental batches.
- **Streaming types freeze after inference.** Set column_types when later batches contain values outside initially inferred types.

```sh
pip install pyarrow
```

**ray-project/ray** (44.3K stars)

[ray-project/ray](https://github.com/ray-project/ray) 

```python
def _read_stream(self, f: "pyarrow.NativeFile", path: str) -> Iterator[Block]:
    import pyarrow as pa
    from pyarrow import csv

    # Re-init invalid row handler: https://issues.apache.org/jira/browse/ARROW-17641
    if hasattr(self.parse_options, "invalid_row_handler"):
        self.parse_options.invalid_row_handler = (
            self.parse_options.invalid_row_handler
        )

    filter_expr = (
        self._predicate_expr.to_pyarrow()
        if self._predicate_expr is not None
        else None
    )

    try:
        reader = csv.open_csv(
            f,
            read_options=self.read_options,
            parse_options=self.parse_options,
            **self.arrow_csv_args,
        )
        schema = None
        while True:
            try:
                batch = reader.read_next_batch()
                table = pa.Table.from_batches([batch], schema=schema)
                if schema is None:
                    schema = table.schema
                if filter_expr is not None:
                    table = table.filter(filter_expr)

                yield table
            except StopIteration:
                return
    except pa.lib.ArrowInvalid as e:
        raise ValueError(
            f"Failed to read CSV file: {path}. "
            "Please check the CSV file has correct format, or filter out non-CSV "
            "file with 'partition_filter' field. See read_csv() documentation for "
            "more details."
        ) from e

```

[python/ray/data/_internal/datasource/csv_datasource.py](https://github.com/ray-project/ray/blob/9be0dbc4858576350eb15e65454c0ccb13265972/python/ray/data/_internal/datasource/csv_datasource.py#L40-L82) · [More projects using pyarrow →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20pyarrow%20for%20typed%20CSV%20imports%2C%20incremental%20processing%2C%20schema%20overrides%20and%20CSV%20export&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
from pyarrow import csv
table = csv.read_csv("data.csv")

```

From [csv.html](https://arrow.apache.org/docs/python/csv.html)

### DuckDB

[GitHub](https://github.com/duckdb/duckdb-python) · [PyPI](https://pypi.org/project/duckdb) · [Docs](https://duckdb.org/docs/2.0/clients/python/reference/)

Runs DuckDB as an in-process database.

- Downloads / mo: 81.2M
- Stars: 206
- Last release: 2.0.0
- License: MIT
- Capabilities: [From the DuckDB docs](https://duckdb.org/docs/2.0/clients/python/reference/)

```sh
pip install duckdb
```

**narwhals-dev/narwhals** (1.8K stars)

[narwhals-dev/narwhals](https://github.com/narwhals-dev/narwhals) 

```python
def scan_csv(
    self, source: NormalizedSource, *, separator: str = ",", **kwds: Any
) -> DuckDBLazyFrame:
    validate_separators(separator, ("delimiter", "delim", "sep"), kwds)
    native = duckdb.read_csv(source, delimiter=separator, **kwds)
    return self._lazyframe.from_native(native, context=self)

```

[src/narwhals/_duckdb/namespace.py](https://github.com/narwhals-dev/narwhals/blob/98d36ec24a05bd9b58f227d5ec5aafcd87eca1c8/src/narwhals/_duckdb/namespace.py#L80-L85) · [More projects using DuckDB →](https://dashboard.exa.ai/playground/search?q=duckdb%20GitHub%20projects)

**Quickstart**

```python
import duckdb
relation = duckdb.read_csv("data.csv")

```

From [README.md](https://duckdb.org/docs/2.0/clients/python/reference/)

### Polars

[GitHub](https://github.com/pola-rs/polars) · [PyPI](https://pypi.org/project/polars) · [Docs](https://docs.pola.rs/api/python/stable/reference/api/polars.read_csv.html)

Reads CSV files into eager DataFrames or lazy query plans.

- Downloads / mo: 68.7M
- Stars: 40.3K
- Last release: 2.1.0
- License: MIT
- Capabilities: [From the Polars docs](https://docs.pola.rs/api/python/stable/reference/api/polars.read_csv.html)

**Strengths**

- **Pushes filters into CSV scans.** Use lazy scans to push predicates and projections toward the reader.
- **Overrides inferred column types.** Specify schema_overrides when selected columns need explicit types.

**Watch out for**

- **Eager reads limit lazy optimization.** Use scan_csv so reader-level optimizations apply during file scanning.

```sh
pip install polars
```

**narwhals-dev/narwhals** (1.8K stars)

[narwhals-dev/narwhals](https://github.com/narwhals-dev/narwhals) 

```python
def scan_csv(
    self, source: NormalizedSource, *, separator: str = ",", **kwds: Any
) -> PolarsLazyFrame:
    native = (
        pl.read_csv(source, separator=separator, **kwds).lazy()
        if self._read_eagerly(source)
        else pl.scan_csv(source, separator=separator, **kwds)
    )
    return self._lazyframe.from_native(native, context=self)

```

[src/narwhals/_polars/namespace.py](https://github.com/narwhals-dev/narwhals/blob/98d36ec24a05bd9b58f227d5ec5aafcd87eca1c8/src/narwhals/_polars/namespace.py#L139-L147) · [More projects using Polars →](https://dashboard.exa.ai/playground/search?q=Public%20Python%20projects%20using%20polars%20for%20typed%20CSV%20imports%2C%20incremental%20processing%2C%20schema%20overrides%20and%20CSV%20export&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D)

**Quickstart**

```python
import polars as pl
frame = pl.read_csv("data.csv")

```

From [csv.py](https://docs.pola.rs/api/python/stable/reference/api/polars.read_csv.html)

### Dask

[GitHub](https://github.com/dask/dask) · [PyPI](https://pypi.org/project/dask) · [Docs](https://docs.dask.org/en/stable/generated/dask.dataframe.read_csv.html)

Parallelizes PyData workloads with task scheduling.

- Downloads / mo: 31.6M
- Stars: 14.0K
- Last release: 2026.8.0
- License: BSD-3-Clause
- Capabilities: [From the Dask docs](https://docs.dask.org/en/stable/generated/dask.dataframe.read_csv.html)

```sh
pip install dask
```

**fugue-project/fugue** (2.2K stars)

[fugue-project/fugue](https://github.com/fugue-project/fugue) 

```python
def _safe_load_csv(path: str, **kwargs: Any) -> dd.DataFrame:
    if not isfile(path):
        return dd.read_csv(join(path, "*.csv"), **kwargs)
    try:
        return dd.read_csv(path, **kwargs)
    except (IsADirectoryError, PermissionError):  # pragma: no cover
        return dd.read_csv(join(path, "*.csv"), **kwargs)

```

[fugue_dask/_io.py](https://github.com/fugue-project/fugue/blob/8bf366ad8f00a800a6ae328fe5032218c1b95330/fugue_dask/_io.py#L102-L108) · [More projects using Dask →](https://dashboard.exa.ai/playground/search?q=dask%20GitHub%20projects)

**Quickstart**

```python
import dask.dataframe as dd
frame = dd.read_csv("data/*.csv")

```

From [dask.dataframe.read_csv.html](https://docs.dask.org/en/stable/generated/dask.dataframe.read_csv.html)

### Tablib

[GitHub](https://github.com/jazzband/tablib) · [PyPI](https://pypi.org/project/tablib) · [Docs](https://tablib.readthedocs.io/en/stable/api.html)

Handles tabular data in many formats, including XLS, JSON, YAML, and CSV.

- Downloads / mo: 5.8M
- Stars: 4.8K
- Last release: 3.10.0
- License: MIT
- Capabilities: [From the Tablib docs](https://tablib.readthedocs.io/en/stable/api.html)

```sh
pip install tablib
```

**MatteoGuadrini/pyreports** (114 stars)

[MatteoGuadrini/pyreports](https://github.com/MatteoGuadrini/pyreports) 

```python
def read(self, **kwargs):
    """Read csv format

    :return: Dataset object
    """
    with open(self.file) as file:
        return tablib.Dataset().load(file, **kwargs)

```

[pyreports/io.py](https://github.com/MatteoGuadrini/pyreports/blob/e9a6d2c77dab73e481da629f092b3b0a7ce909e3/pyreports/io.py#L208-L214) · [More projects using Tablib →](https://dashboard.exa.ai/playground/search?q=tablib%20GitHub%20projects)

**Quickstart**

```python
import tablib
data = tablib.Dataset().load("name,score\nAda,9\n", format="csv")

```

From [api.html](https://tablib.readthedocs.io/en/stable/api.html)

### CleverCSV

[GitHub](https://github.com/alan-turing-institute/CleverCSV) · [PyPI](https://pypi.org/project/clevercsv) · [Docs](https://clevercsv.readthedocs.io/en/latest/)

Reads messy CSV files.

- Downloads / mo: 1.1M
- Stars: 1.3K
- Last release: 0.8.5
- License: MIT
- Capabilities: [From the CleverCSV docs](https://clevercsv.readthedocs.io/en/latest/)

```sh
pip install clevercsv
```

**mathesar-foundation/mathesar** (5.2K stars)

[mathesar-foundation/mathesar](https://github.com/mathesar-foundation/mathesar) 

```python
def copy_datafile_to_table(
    user,
    data_file_id,
    table_name,
    schema_oid,
    conn,
    comment=None,
    import_into_temp_table=False,
    header_to_validate=[]
):
    data_file = DataFile.objects.get(id=data_file_id, user=user)
    header = data_file.header
    dialect = csv.dialect.SimpleDialect(
        data_file.delimiter,
        data_file.quotechar,
        data_file.escapechar
    )
    table_name = table_name or data_file.base_name

    with data_file.file.open("rb") as raw:
        f = io.TextIOWrapper(raw, encoding=data_file.encoding, newline="")
        reader = csv.reader(f, dialect)
        first_row = next(reader)
        if header:
            if import_into_temp_table:
                assert list(enumerate(first_row)) == header_to_validate, "Parsing mismatch"
            column_names = _process_column_names(first_row)
            rows = reader
        else:
            column_names = [
                f"{COLUMN_NAME_TEMPLATE}{i}" for i in range(len(first_row))
            ]
            # The first row is data, not a header: chain it back in
            rows = itertools.chain([first_row], reader)
        processed_rows = ([None if val == '' else val for val in row] for row in rows)
        import_info = create_and_import_from_rows(
            processed_rows,
            table_name,
            schema_oid,
            column_names,
            conn,
            comment=comment,
            import_into_temp_table=import_into_temp_table
        )

    return {
        "oid": import_info['table_oid'],
        "name": import_info.get('table_name'),
        "renamed_columns": import_info.get('renamed_columns'),
        "pkey_column_attnum": import_info.get('pkey_column_attnum'),
    }

```

[mathesar/imports/datafile.py](https://github.com/mathesar-foundation/mathesar/blob/3833c3ae5714f164dd6870f4d28865e78d60a4cc/mathesar/imports/datafile.py#L14-L64) · [More projects using CleverCSV →](https://dashboard.exa.ai/playground/search?q=clevercsv%20GitHub%20projects)

**Quickstart**

```python
import clevercsv
rows = clevercsv.read_table('./imdb.csv')

```

From [README.rst](https://clevercsv.readthedocs.io/en/latest/)

### petl

[GitHub](https://github.com/petl-developers/petl) · [PyPI](https://pypi.org/project/petl) · [Docs](https://github.com/petl-developers/petl/blob/master/petl/io/csv.py)

Extracts, transforms, and loads tables of data.

- Downloads / mo: 1.1M
- Stars: 1.3K
- Last release: 1.7.33
- License: MIT
- Capabilities: [From the petl docs](https://github.com/petl-developers/petl/blob/master/petl/io/csv.py)

```sh
pip install petl
```

**redstreet/beancount_reds_importers** (166 stars)

[redstreet/beancount_reds_importers](https://github.com/redstreet/beancount_reds_importers) 

```python
def read_raw(self, file):
    return etl.fromcsv(
        file,
        encoding=getattr(self, "file_encoding", None),
        delimiter=getattr(self, "csv_delimiter", ","),
    )

```

[beancount_reds_importers/libreader/csvreader.py](https://github.com/redstreet/beancount_reds_importers/blob/7a3f7c73bac42696b5fb82d53030cf5dad241419/beancount_reds_importers/libreader/csvreader.py#L151-L156) · [More projects using petl →](https://dashboard.exa.ai/playground/search?q=petl%20GitHub%20projects)

**Quickstart**

```python
import petl as etl
table = etl.fromcsv("data.csv")
rows = list(table)

```

From [csv.py](https://github.com/petl-developers/petl/blob/master/petl/io/csv.py)

## FAQ

### Which Python CSV library should I use?

[pandas](#pandas) suits most analysis work that loads a CSV into a DataFrame. [Polars](#polars) suits large files, with lazy scans that push filters and column selection into the read. [CleverCSV](#clevercsv) suits messy files with an unknown dialect.

### How do I read a CSV file in Python?

The built-in csv module reads a file row by row. [pandas](#pandas) reads the whole file into a DataFrame with `read_csv`, and [Polars](#polars) offers its own `read_csv` and `scan_csv`.

### Polars vs pandas: which should I use for CSV files?

[Polars](#polars) reads CSV files into eager DataFrames or lazy query plans. [pandas](#pandas) reads CSV data into an eager DataFrame with many parsing and conversion options.

### How do I read a CSV with pandas?

Call `pandas.read_csv` with a local path or URL. It returns a DataFrame, and its keyword arguments control the delimiter, column types, and parsing.

### How do I read a CSV with Polars?

Call `polars.read_csv` for a DataFrame or `polars.scan_csv` for a LazyFrame. Both accept a separator and other keyword options.

## How this page was built

Data checked Nov 20, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python CSV libraries csv pandas Polars PyArrow code examples",
    "numResults": 5
  }
}
```

Docs: https://exa.ai/docs/reference/search
