Use this file to discover Exa products, pricing, evaluations, comparisons, use cases, agent interfaces, and technical documentation before exploring further.
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
pandas has the most monthly downloads in this comparison, at 688.5M.
Downloads: PyPI, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.
Libraries and code examples
pandas
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
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.
Limitations
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.
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
pyarrow
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
Strengths
Shared column format.Polars, DuckDB, and pandas exchange data through Arrow tables instead of converting row by row.
Limitations
Windows wheels need a runtime.Importing the pip wheels on Windows can require the latest Visual C++ Redistributable.
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)
DuckDB
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
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.
Limitations
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.
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()
Polars
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
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.
Limitations
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.
@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)
PySpark
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
Strengths
One engine for SQL and DataFrames.Spark SQL and the DataFrame API share an execution engine and query the same registered views.
Limitations
Cluster setup is separate.The package runs Spark locally or connects to an existing cluster. A new standalone cluster needs the full Spark distribution.
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)
Dask
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
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.
Limitations
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.
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
xarray
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
Strengths
Named dimensions.Code refers to dimensions such as time or latitude by name, independent of axis order.
Limitations
Queries without SQL.Selection runs through Python and pandas expressions. SQL needs a conversion to a dataframe first.
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")
Ibis
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
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.
Limitations
Backend support varies.Each backend implements its own set of operations and its own SQL dialect.
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()
FAQ
pandas handles tables that fit in memory, with each operation running as soon as it is called. Polars and DuckDB run larger queries on one machine, Polars through a dataframe API and DuckDB through SQL. PySpark and Dask spread the work across a cluster.
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.
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.
Ibis 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.
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 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.
For coding agents
Found your data analysis library? Help your agent use it.
Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.