# Python data analysis libraries

Python data analysis libraries load tables of data and filter, join, group, and summarize them. These libraries prepare the data behind reports, dashboards, and machine learning models.

## Popularity

| Library | Monthly downloads | Stars | Last release | License |
| --- | --- | --- | --- | --- |
| [pandas](#pandas) | 706.0M | 49.6K | Nov 2026 | BSD-3-Clause |
| [pyarrow](#pyarrow) | 435.9M | 17.3K | Nov 2026 | Apache-2.0 |
| [DuckDB](#duckdb) | 80.0M | 207 | Oct 2026 | MIT |
| [Polars](#polars) | 68.0M | 40.4K | Oct 2026 | MIT |
| [PySpark](#pyspark) | 48.4M | 44.6K | Oct 2026 | Apache-2.0 |
| [Dask](#dask) | 31.5M | 14.0K | Aug 2026 | BSD-3-Clause |
| [xarray](#xarray) | 12.9M | 4.2K | Sep 2026 | Apache-2.0 |
| [Ibis](#ibis-framework) | 3.6M | 6.7K | Feb 2026 | Apache-2.0 |

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

[pandas](#pandas) has the most monthly downloads in this comparison, at 688.5M.

## Capabilities

| Library | Deferred execution | SQL over frames |
| --- | --- | --- |
| [pandas](#pandas) | No | Via plugin |
| [pyarrow](#pyarrow) | Yes | Via plugin |
| [DuckDB](#duckdb) | Yes | Yes |
| [Polars](#polars) | Yes | Yes |
| [PySpark](#pyspark) | Yes | Yes |
| [Dask](#dask) | Yes | Undocumented |
| [xarray](#xarray) | Via plugin | No |
| [Ibis](#ibis-framework) | Yes | Yes |

## Libraries

### pandas

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

pandas holds tabular data in a `DataFrame`, a table of labeled columns that can each hold a different type, such as text, numbers, or dates. Operations run as soon as they are called and keep the whole table in memory. The library aligns rows by label in arithmetic, groups data for split-apply-combine operations, and marks missing values as `NaN`, `NA`, or `NaT`. Readers and writers cover CSV files, Excel files, and SQL databases.

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

**Strengths**

- **Stores mixed-type table columns.** Organize named columns containing text, numbers, and other supported data types.
- **Processes suitable workloads in chunks.** Split supported workflows into chunks that each fit in memory.

**Watch out for**

- **Data must fit in memory.** Each operation loads its data into RAM. Larger datasets need chunked reading or another engine, such as Dask or Polars.
- **Parallel work needs numba.** Parallel column-wise computation runs only through the optional numba engine.

```sh
pip install pandas
```

**freqtrade/freqtrade** (56.9K stars)

[freqtrade/freqtrade](https://github.com/freqtrade/freqtrade) 

```python
def ohlcv_fill_up_missing_data(
    dataframe: DataFrame,
    timeframe: str,
    pair: str,
    candle_type: CandleType = CandleType.SPOT,
) -> DataFrame:
    """
    Fills up missing data with 0 volume rows,
    using the previous close as price for "open", "high", "low" and "close", volume is set to 0

    Candle types that carry a single value (e.g. funding rates) have no candle to fabricate -
    inventing one would silently make up rates - so they are returned unchanged.
    """
    if not candle_type_is_ohlcv(candle_type):
        logger.debug(f"Skipping fillup for {pair}, {timeframe} - not applicable to {candle_type}.")
        return dataframe

    from freqtrade.exchange import timeframe_to_resample_freq

    ohlcv_dict = {"open": "first", "high": "max", "low": "min", "close": "last", "volume": "sum"}
    resample_interval = timeframe_to_resample_freq(timeframe)
    # Resample to create "NAN" values
    df = dataframe.resample(resample_interval, on="date").agg(ohlcv_dict)

    # Forwardfill close for missing columns
    df["close"] = df["close"].ffill()
    # Use close for "open, high, low"
    df.loc[:, ["open", "high", "low"]] = df[["open", "high", "low"]].fillna(
        value={
            "open": df["close"],
            "high": df["close"],
            "low": df["close"],
        }
    )
    df = df.reset_index()
    len_before = len(dataframe)
    len_after = len(df)
    pct_missing = (len_after - len_before) / len_before if len_before > 0 else 0
    if len_before != len_after:
        message = (
            f"Missing data fillup for {pair}, {timeframe}: "
            f"before: {len_before} - after: {len_after} - {pct_missing:.2%}"
        )
        if pct_missing > 0.01:
            logger.info(message)
        else:
            # Don't be verbose if only a small amount is missing
            logger.debug(message)
    return df

```

[freqtrade/data/converter/converter.py](https://github.com/freqtrade/freqtrade/blob/b6d30da09b6745065bf60d464286ebb1b889ccbe/freqtrade/data/converter/converter.py#L128-L176) · [More projects using pandas →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pandas%20for%20timestamp%20normalization%2C%20ordered%20row%20indexes%2C%20aligned%20chunk%20selection%20and%20dataframe%20materialization&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

d = {"col1": [1, 2], "col2": [3, 4]}
df = pd.DataFrame(data=d)
print(df)

```

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

### pyarrow

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

PyArrow is the Python library for Apache Arrow, a columnar memory format for tabular data. `pa.table` builds a typed, column-oriented table from arrays, and the library converts to and from pandas and NumPy. Polars and DuckDB read Arrow data directly, so a table can pass between them without a copy. Its Acero engine and dataset scanner run deferred queries over collections of files.

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

**Strengths**

- **Shared column format.** Polars, DuckDB, and pandas exchange data through Arrow tables instead of converting row by row.

**Watch out for**

- **Windows wheels need a runtime.** Importing the pip wheels on Windows can require the latest Visual C++ Redistributable.

```sh
pip install pyarrow
```

**huggingface/datasets** (22.2K stars)

[huggingface/datasets](https://github.com/huggingface/datasets) 

```python
def table_iter(table: Table, batch_size: int, drop_last_batch=False) -> Iterator[pa.Table]:
    """Iterate over sub-tables of size `batch_size`.

    Args:
        table (`pyarrow.Table`):
            PyArrow table to iterate over.
        batch_size (`int`):
            Size of each sub-table to yield.
        drop_last_batch (`bool`, defaults to `False`):
            Drop the last batch if it is smaller than `batch_size`.
    """
    chunks_buffer = []
    chunks_buffer_size = 0
    for chunk in table.to_reader(max_chunksize=batch_size):
        if len(chunk) == 0:
            continue
        elif chunks_buffer_size + len(chunk) < batch_size:
            chunks_buffer.append(chunk)
            chunks_buffer_size += len(chunk)
            continue
        elif chunks_buffer_size + len(chunk) == batch_size:
            chunks_buffer.append(chunk)
            yield pa.Table.from_batches(chunks_buffer)
            chunks_buffer = []
            chunks_buffer_size = 0
        else:
            cropped_chunk_length = batch_size - chunks_buffer_size
            chunks_buffer.append(chunk.slice(0, cropped_chunk_length))
            yield pa.Table.from_batches(chunks_buffer)
            chunks_buffer = [chunk.slice(cropped_chunk_length, len(chunk) - cropped_chunk_length)]
            chunks_buffer_size = len(chunk) - cropped_chunk_length
    if not drop_last_batch and chunks_buffer:
        yield pa.Table.from_batches(chunks_buffer)

```

[src/datasets/table.py](https://github.com/huggingface/datasets/blob/39fd698d619816099ffa8eb07b5c79b0f4f5f299/src/datasets/table.py#L2475-L2507) · [More projects using pyarrow →](https://dashboard.exa.ai/playground/search?q=pyarrow%20GitHub%20projects)

**Quickstart**

```python
import pyarrow as pa
n_legs = pa.array([2, 4, 5, 100])
animals = pa.array(["Flamingo", "Horse", "Brittle stars", "Centipede"])
names = ["n_legs", "animals"]
pa.table({"n_legs": n_legs, "animals": animals})

```

From [pyarrow.table.html](https://arrow.apache.org/docs/python/generated/pyarrow.table.html)

### DuckDB

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

DuckDB is an analytical SQL database that runs inside the Python process, with no server and no external dependencies. `duckdb.sql` runs a query and returns a relation, and a query can name a pandas DataFrame or an Arrow table in its `FROM` clause as if it were a database table. DuckDB reads and writes CSV, Parquet, and JSON files, locally or in remote storage buckets, and processes workloads larger than memory.

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

**Strengths**

- **Queries pandas dataframes directly.** Run SQL against pandas DataFrames without importing them into database tables.
- **Spills larger workloads to disk.** Process eligible larger-than-memory queries using temporary disk storage.

**Watch out for**

- **Some aggregates stay in memory.** Aggregate states that cannot spill to disk must fit in available memory.
- **Relations rerun on access.** A relation runs its query again each time it is read. Materializing the result avoids the repeat work.

```sh
pip install duckdb
```

**duckdb/dbt-duckdb** (1.4K stars)

[duckdb/dbt-duckdb](https://github.com/duckdb/dbt-duckdb) 

```python
def load_source(self, plugin_name: str, source_config: utils.SourceConfig):
    if plugin_name not in self._plugins:
        raise Exception(
            f"Plugin {plugin_name} not found; known plugins are: "
            + ",".join(self._plugins.keys())
        )
    plugin = self._plugins[plugin_name]
    handle = self.handle()
    cursor = handle.cursor()

    if source_config.schema:
        cursor.execute(f"CREATE SCHEMA IF NOT EXISTS {source_config.schema}")

    save_mode = source_config.get("save_mode", "overwrite")
    if save_mode in ("ignore", "error_if_exists"):
        params = [source_config.schema, source_config.identifier]
        q = """SELECT COUNT(1)
            FROM system.information_schema.tables
            WHERE table_schema = ?
            AND table_name = ?
            """
        if source_config.database:
            q += "AND table_catalog = ?"
            params.append(source_config.database)
        # fetchall() drains the result; DuckDB 2.0 rejects register() on a cursor
        # whose result was only partially fetched.
        if cursor.execute(q, params).fetchall()[0][0]:
            if save_mode == "error_if_exists":
                raise Exception(f"Source {source_config.table_name()} already exists!")
            else:
                # Nothing to do (we ignore the existing table)
                return
    df = plugin.load(source_config)
    assert df is not None

    materialization = source_config.meta.get(
        "materialization", plugin.default_materialization()
    )
    source_table_name = source_config.table_name()
    df_name = source_table_name.replace(".", "_") + "_df"

    cursor.register(df_name, df)

    if materialization == "view":
        # save to df instance to register on each cursor creation
        self._REGISTERED_DF[df_name] = df

    cursor.execute(
        f"CREATE OR REPLACE {materialization} {source_table_name} AS SELECT * FROM {df_name}"
    )

    cursor.close()
    handle.close()

```

[dbt/adapters/duckdb/environments/local.py](https://github.com/duckdb/dbt-duckdb/blob/e14e11c2c362230c10f42ae12ed3d942ca871a08/dbt/adapters/duckdb/environments/local.py#L96-L148) · [More projects using DuckDB →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20duckdb%20for%20timestamp%20normalization%2C%20ordered%20row%20indexes%2C%20aligned%20chunk%20selection%20and%20dataframe%20materialization&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 duckdb

duckdb.sql("SELECT 42").show()

```

From [overview.html](https://duckdb.org/docs/2.0/clients/python/overview.html)

### Polars

[GitHub](https://github.com/pola-rs/polars) · [PyPI](https://pypi.org/project/polars) · [Docs](https://docs.pola.rs/)

Polars is a dataframe query engine written in Rust. Queries go through its expression API, through SQL, or through both, and share one optimizer. Functions such as `pl.scan_parquet` start a lazy query that runs at `collect`, after Polars has optimized it, with execution spread across all CPU cores. Operations that exceed RAM can spill to disk, and data passes to other tools in the Arrow format without copying.

- Downloads / mo: 68.0M
- Stars: 40.4K
- Last release: 2.1.0
- License: MIT
- Capabilities: [From the Polars docs](https://docs.pola.rs/)

**Strengths**

- **Defers work until collection.** Build a lazy plan, then execute it when collecting the result.
- **Parallelizes native dataframe expressions.** Run eligible expressions and grouped computations across CPU threads.

**Watch out for**

- **Streaming falls back to memory.** Operations the streaming engine does not support run on the in-memory engine instead.
- **SQL trails expressions.** New features reach the expression API before the SQL interface.

```sh
pip install polars
```

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

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

```python
@classmethod
def from_dicts(
    cls,
    data: Sequence[Mapping[str, Any]],
    /,
    *,
    context: _LimitedContext,
    schema: Mapping[str, IntoDType | None] | None,
) -> Self:
    pl_schema = (
        {
            key: narwhals_to_native_dtype(dtype, context._version)
            if dtype is not None
            else None
            for (key, dtype) in schema.items()
        }
        if schema
        else None
    )
    if not data:
        native = pl.DataFrame(schema=pl_schema)
    elif FROM_DICTS_ACCEPTS_MAPPINGS or isinstance(data[0], dict):
        native = pl.from_dicts(data, pl_schema)
    else:  # pragma: no cover
        columns = pl_schema or tuple(data[0])
        native = pl.DataFrame(
            (tuple(row.values()) for row in data), schema=columns, orient="row"
        )

    return cls.from_native(native, context=context)

```

[src/narwhals/_polars/dataframe.py](https://github.com/narwhals-dev/narwhals/blob/98d36ec24a05bd9b58f227d5ec5aafcd87eca1c8/src/narwhals/_polars/dataframe.py#L361-L390) · [More projects using Polars →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20polars%20for%20timestamp%20normalization%2C%20ordered%20row%20indexes%2C%20aligned%20chunk%20selection%20and%20dataframe%20materialization&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
import datetime as dt

df = pl.DataFrame(
    {
        "name": ["Alice Archer", "Ben Brown", "Chloe Cooper", "Daniel Donovan"],
        "birthdate": [
            dt.date(1997, 1, 10),
            dt.date(1985, 2, 15),
            dt.date(1983, 3, 22),
            dt.date(1981, 4, 30),
        ],
        "weight": [57.9, 72.5, 53.6, 83.1],  # (kg)
        "height": [1.56, 1.77, 1.65, 1.75],  # (m)
    }
)

print(df)

```

From [getting-started.md](https://docs.pola.rs/user-guide/getting-started/)

### PySpark

[GitHub](https://github.com/apache/spark) · [PyPI](https://pypi.org/project/pyspark) · [Docs](https://spark.apache.org/docs/4.3.0/api/python/)

PySpark is the Python API for Apache Spark, an engine for large-scale data processing. A `SparkSession` creates DataFrames, and transformations on them build a plan that runs when an action such as `show` or `collect` asks for results. Spark SQL queries the same DataFrames, and the pandas API on Spark accepts pandas-style code. The `pyspark` package bundles Spark's JAR files for local development or for connecting to an existing cluster.

- Downloads / mo: 48.4M
- Stars: 44.6K
- Last release: 4.3.0
- License: Apache-2.0
- Capabilities: [From the PySpark docs](https://spark.apache.org/docs/4.3.0/api/python/)

**Strengths**

- **One engine for SQL and DataFrames.** Spark SQL and the DataFrame API share an execution engine and query the same registered views.

**Watch out for**

- **Cluster setup is separate.** The package runs Spark locally or connects to an existing cluster. A new standalone cluster needs the full Spark distribution.

```sh
pip install pyspark
```

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

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

```python
def save(self, data: DataFrame | pd.DataFrame) -> None:
    """Saves pyspark dataframe.

    Args:
        data: PySpark DataFrame or Pandas DataFrame to save.
              Pandas DataFrames will be automatically converted to Spark.
    """
    import pandas as pd  # noqa: PLC0415

    spark_session = get_spark_with_remote_support()

    # Convert Pandas DataFrame to Spark DataFrame if needed
    if isinstance(data, pd.DataFrame):
        data = spark_session.createDataFrame(data)

    save_path = self._get_save_path()
    spark_save_path = to_spark_path(self._protocol, str(save_path))

    # Create a copy of save_args to avoid mutation
    save_args = self._save_args.copy()

    # Extract mode and partitionBy (these are handled separately by Spark)
    mode = save_args.pop("mode", None)
    partition_by = save_args.pop("partitionBy", None)

    # Prepare writer
    writer = data.write

    if mode:
        writer = writer.mode(mode)
    if partition_by:
        writer = writer.partitionBy(partition_by)

    # Save with remaining options
    writer.format(self._file_format).options(**save_args).save(spark_save_path)

```

[kedro-datasets/kedro_datasets/spark/spark_dataset_v2.py](https://github.com/kedro-org/kedro-plugins/blob/f2516d069e6930c5dd3e1598642e736d7e66fa5f/kedro-datasets/kedro_datasets/spark/spark_dataset_v2.py#L258-L292) · [More projects using PySpark →](https://dashboard.exa.ai/playground/search?q=pyspark%20GitHub%20projects)

**Quickstart**

```python
from pyspark.sql import SparkSession

spark = SparkSession.builder.getOrCreate()

from datetime import datetime, date
from pyspark.sql import Row

df = spark.createDataFrame([
    Row(a=1, b=2., c='string1', d=date(2000, 1, 1), e=datetime(2000, 1, 1, 12, 0)),
    Row(a=2, b=3., c='string2', d=date(2000, 2, 1), e=datetime(2000, 1, 2, 12, 0)),
    Row(a=4, b=5., c='string3', d=date(2000, 3, 1), e=datetime(2000, 1, 3, 12, 0))
])
df

df.show()

```

From [quickstart_df.html](https://spark.apache.org/docs/4.3.0/api/python/getting_started/quickstart_df.html)

### Dask

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

Dask is a parallel computing library that splits pandas dataframes and NumPy arrays into partitions and runs operations on them as a task graph. `dd.from_pandas` turns a pandas DataFrame into a Dask DataFrame, and calls such as `mean()` add to the graph without running it until `compute()`. The same graph runs on threads, on processes, or on a distributed cluster.

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

**Strengths**

- **Partitions familiar pandas dataframes.** Process tabular data through coordinated pandas partitions.
- **Scales across a computer cluster.** Run partitioned analysis on one machine or a distributed cluster.

**Watch out for**

- **Threads share the interpreter lock.** Python-heavy code runs one thread at a time. The process or distributed scheduler runs that code in parallel.
- **Shuffles move data.** Joining or regrouping by a new key moves rows between many partitions.

```sh
python -m pip install "dask[dataframe]"
```

**dask/dask-ml** (951 stars)

[dask/dask-ml](https://github.com/dask/dask-ml) 

```python
def _blockwise_slice(arr, idx):
    """Slice an array that is blockwise-aligned with idx.

    Parameters
    ----------
    arr : Dask array
    idx : Dask array
        Should have the following properties

        * Same blocks as `arr` along the first dimension
        * Contains only integers
        * Each block's values should be between ``[0, len(block))``

    Returns
    -------
    sliced : dask.Array
    """
    objs = []
    offsets = np.hstack([0, np.cumsum(arr.chunks[0])[:-1]])

    for i, (x, idx2) in enumerate(
        zip(arr.to_delayed().ravel(), idx.to_delayed().ravel())
    ):
        idx3 = idx2 - offsets[i]
        objs.append(x[idx3])

    shapes = idx.chunks[0]
    if arr.ndim == 2:
        P = arr.shape[1]
        shapes = [(x, P) for x in shapes]
    else:
        shapes = [(x,) for x in shapes]

    sliced = da.concatenate(
        [
            da.from_delayed(x, shape=shape, dtype=arr.dtype)
            for x, shape in zip(objs, shapes)
        ]
    )
    return sliced

```

[dask_ml/model_selection/_split.py](https://github.com/dask/dask-ml/blob/fcc8111ac686e086985902f2050b3b17464966dc/dask_ml/model_selection/_split.py#L319-L358) · [More projects using Dask →](https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20dask%20for%20timestamp%20normalization%2C%20ordered%20row%20indexes%2C%20aligned%20chunk%20selection%20and%20dataframe%20materialization&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 numpy as np
import pandas as pd
import dask.dataframe as dd

index = pd.date_range("2021-09-01", periods=2400, freq="1h")
df = pd.DataFrame({"a": np.arange(2400), "b": list("abcaddbe" * 300)}, index=index)
ddf = dd.from_pandas(df, npartitions=10)
ddf

ddf.a.mean()
ddf.a.mean().compute()

```

From [Ten minutes to Dask](https://docs.dask.org/en/stable/10-minutes-to-dask.html)

### xarray

[GitHub](https://github.com/pydata/xarray) · [PyPI](https://pypi.org/project/xarray) · [Docs](https://docs.xarray.dev/en/stable/)

xarray adds labels, in the form of named dimensions, coordinates, and attributes, to NumPy-like arrays with any number of dimensions. Operations take dimension names instead of axis positions, as in `x.sum('time')`, and selection works by label. The data model comes from netCDF files, which xarray reads and writes, and Dask can back the arrays for parallel and out-of-memory work.

- Downloads / mo: 12.9M
- Stars: 4.2K
- Last release: 2026.9.0
- License: Apache-2.0
- Capabilities: [From the xarray docs](https://docs.xarray.dev/en/stable/)

**Strengths**

- **Named dimensions.** Code refers to dimensions such as time or latitude by name, independent of axis order.

**Watch out for**

- **Queries without SQL.** Selection runs through Python and pandas expressions. SQL needs a conversion to a dataframe first.

```sh
pip install xarray
```

**Ouranosinc/xclim** (412 stars)

[Ouranosinc/xclim](https://github.com/Ouranosinc/xclim) 

```python
def day_to_day_variability(data: xr.DataArray, freq: Freq = "YS", subfreq: Freq = "MS"):
    """
    Compute the mean of day-to-day variability.

    Computes the standard deviation of the variable within each sub-period (e.g. month),
    then averages those standard deviations over the main resampling period (e.g. year).
    This provides a measure of typical day-to-day variability as described in :cite:t:`kotz_2021`.

    Parameters
    ----------
    data : xr.DataArray
        The input variable.
    freq : Freq
        Resampling frequency used to average the sub-period standard deviations. Default: "YS".
    subfreq : Freq
        Resampling frequency used to compute the standard deviation. Default: "MS".

    Returns
    -------
    xr.DataArray, [same as data]
        Mean of the sub-period standard deviations over each period defined by `freq`.

    References
    ----------
    :cite:cts:`kotz_2021`
    """
    if compare_offsets(freq, "<=", subfreq):
        raise ValueError("Averaging frequency must be larger than the variability frequency.")
    variability = data.resample({"time": subfreq}).std(dim="time", keep_attrs=True)
    out = variability.resample({"time": freq}).mean(dim="time", keep_attrs=True)
    return to_agg_units(out, to_agg_units(variability, data, "std"), "mean")

```

[src/xclim/compute/generic.py](https://github.com/Ouranosinc/xclim/blob/3621f3cc4ee620a3ffb628be88677859445a6257/src/xclim/compute/generic.py#L1545-L1575) · [More projects using xarray →](https://dashboard.exa.ai/playground/search?q=xarray%20GitHub%20projects)

**Quickstart**

```python
import numpy as np
import pandas as pd
import xarray as xr

data = xr.DataArray(np.random.randn(2, 3), dims=("x", "y"), coords={"x": [10, 20]})
data

```

From [quick-overview.rst](https://docs.xarray.dev/en/stable/getting-started-guide/quick-overview.html)

### Ibis

[GitHub](https://github.com/ibis-project/ibis) · [PyPI](https://pypi.org/project/ibis-framework) · [Docs](https://ibis-project.org/)

Ibis is a dataframe library that builds lazy expressions and compiles them for a separate backend to run, DuckDB by default. The same API covers more than twenty backends, so code written against a local file can move to a remote database by changing the connection. `ibis.connect` opens a backend, and `Table.sql` mixes SQL into a table expression.

- Downloads / mo: 3.6M
- Stars: 6.7K
- Last release: 12.0.0
- License: Apache-2.0
- Capabilities: [From the Ibis docs](https://ibis-project.org/)

**Strengths**

- **One API, many backends.** The same dataframe code runs on DuckDB, Polars, PySpark, Snowflake, BigQuery, PostgreSQL, and other backends.
- **Dataframes and SQL together.** Dataframe expressions and SQL strings compose in one query.

**Watch out for**

- **Backend support varies.** Each backend implements its own set of operations and its own SQL dialect.

```sh
pip install 'ibis-framework[duckdb,examples]'
```

**marimo-team/marimo** (23.6K stars)

[marimo-team/marimo](https://github.com/marimo-team/marimo) 

```python
def _get_numeric_bin_values(
    self, col: ibis.Column, num_bins: int
) -> ibis.Table:
    data = self._original_data
    min_val = col.min().execute()
    max_val = col.max().execute()

    # Handle case where all values are the same
    if min_val == max_val:
        # Create a single bin with all the data
        total_count = col.count().execute()
        return ibis.memtable(
            {
                "bin": [0],
                "count": [total_count],
                "bin_start": [min_val],
                "bin_end": [max_val],
            }
        ).execute()

    bin_width = (max_val - min_val) / num_bins

    # Assign bins and count occurrences
    data = data.mutate(bin=col.histogram(nbins=num_bins))
    value_counts = data["bin"].value_counts(name="count")

    # Fill in missing bins
    all_bins = ibis.range(num_bins).unnest().name("bin").as_table()
    joined = all_bins.left_join(value_counts, "bin").mutate(
        count=ibis.coalesce(value_counts["count"], 0)
    )

    # Compute bin_start and bin_end for each bin
    # If the last bin, we use the last value for bin_end, else calculate the bin_end
    result = joined.mutate(
        bin_start=min_val + joined["bin"] * bin_width,
        bin_end=ibis.cases(
            (joined["bin"] == (num_bins - 1), max_val),
            else_=min_val + (joined["bin"] + 1) * bin_width,
        ),
    ).order_by("bin")

    return result.execute()

```

[marimo/_plugins/ui/_impl/tables/ibis_table.py](https://github.com/marimo-team/marimo/blob/24459dbf2a6b630c135dcb3d9c616543874e0f88/marimo/_plugins/ui/_impl/tables/ibis_table.py#L50-L92) · [More projects using Ibis →](https://dashboard.exa.ai/playground/search?q=ibis-framework%20GitHub%20projects)

**Quickstart**

```python
import ibis

con = ibis.connect("duckdb://penguins.ddb")
con.create_table(
    "penguins", ibis.examples.penguins.fetch().to_pyarrow(), overwrite=True
)

```

From [basics.qmd](https://ibis-project.org/tutorials/basics)

## FAQ

### Which Python data analysis library should I use?

[pandas](#pandas) handles tables that fit in memory, with each operation running as soon as it is called. [Polars](#polars) and [DuckDB](#duckdb) run larger queries on one machine, Polars through a dataframe API and DuckDB through SQL. [PySpark](#pyspark) and [Dask](#dask) spread the work across a cluster.

### Polars vs pandas: which should I use?

pandas runs each operation immediately and keeps the table in memory. Polars can build a lazy query, optimize it, and run it across all CPU cores, and operations that exceed RAM can spill to disk. Polars stores data in the Apache Arrow format, which it shares with other tools without copying.

### PySpark vs pandas: which should I use?

pandas runs on one machine and holds the data in memory. PySpark sends the work to Spark, which plans transformations and runs them when an action such as `show` or `collect` asks for results, on a local machine or a cluster.

### What is Ibis in Python?

[Ibis](#ibis-framework) is a dataframe library that builds lazy expressions and runs them on a separate backend, DuckDB by default. The same code runs on more than twenty backends, so moving from a laptop to a remote database means changing the connection.

### DuckDB vs Polars: which should I use?

Both run analytical queries inside the Python process and can handle data larger than memory. DuckDB is a SQL database that queries pandas and Arrow data directly, while Polars centers on a dataframe expression API and also accepts SQL.

### Dask vs Spark: which should I use?

Dask splits pandas dataframes and NumPy arrays into partitions and schedules them from Python, on one machine or a cluster. Spark is a separate engine that PySpark drives, with DataFrames and SQL sharing one planner.

## How this page was built

Data checked Nov 19, 2026.

Reproduce it with the Exa API:

```json
{
  "endpoint": "/search",
  "body": {
    "query": "Best Python data analysis libraries pandas Polars Dask DuckDB dataframe SQL larger than memory code examples",
    "numResults": 5
  }
}
```

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