All operations
Every Kwker operation in one list, grouped by task. Each row links to the guide that explains it with examples.
The names are the Python ones; other languages use the same names in their own style (for example top_k is TopK
in Go and topK in JavaScript). See Languages.
Sorting
| You want to | Call | Guide |
|---|---|---|
| Sort an array in place | sort |
Sorting |
| Get a sorted copy | sorted |
Sorting |
| Sort every row or column of a matrix | sort(a, axis=...) |
Sorting |
| Sort on several cores | sort(a, threads=...) |
Large data |
| Sort strings | sort_ |
Strings |
| Sort keys and move values with them | sort_ |
Keys with values |
| Sort a file larger than memory | sort_ |
Large data |
Finding the top values
| You want to | Call | Guide |
|---|---|---|
| The k largest or smallest, with positions | top_ |
Top-k and selection |
| Only the positions of the k largest or smallest | argselect |
Top-k and selection |
| The median or any percentile | select |
Top-k and selection |
| The first k positions sorted | partial_ |
Top-k and selection |
| The top k among selected entries | top_ |
Top-k and selection |
| The top k of every group or segment | top_, top_ |
Top-k and selection |
| A median, quantile or median absolute deviation over a sliding window | rolling_, rolling_, rolling_ |
Top-k and selection |
| A trimmed mean or a weighted quantile | trim_, weighted_ |
Statistics |
| Average precision or ROC AUC of a classifier | average_, roc_ |
Statistics |
Order and ranks
| You want to | Call | Guide |
|---|---|---|
| The positions that would sort an array | argsort |
Order and ranking |
| Ranks (average, min, max, dense, ordinal) | rank |
Order and ranking |
| Ranks between 0 and 1 | percent_ |
Order and ranking |
| Sort rows by several columns | lexsort |
Order and ranking |
| The first k rows by several columns | lex_ |
Order and ranking |
| Reorder records without a copy | permute_ |
Order and ranking |
Searching sorted data
| You want to | Call | Guide |
|---|---|---|
| Where values would go in a sorted array | searchsorted |
Searching |
| The bucket of every value | bucketize |
Searching |
| How many values fall in each bucket | bucket_ |
Searching |
Statistics and data helpers
| You want to | Call | Guide |
|---|---|---|
| Running totals, lags and ranks within groups | group_, group_, group_, rank_ |
Statistics |
| Medians and quantiles of everything so far | expanding_, expanding_ |
Statistics |
| How far apart two samples are (KS, Wasserstein, energy) | cdf_ |
Statistics |
| Discordant pairs (Kendall tau) | count_ |
Statistics |
| Counts in uniform bins | histogram |
Statistics |
| The latest row at or before each time (as-of join) | asof_ |
Statistics |
| Shared or distinct ids per row | row_, row_ |
Statistics |
| Top-p, top-n-sigma, min-p and per-row top-k filters of logits | top_, top_, min_, top_ |
Statistics |
| Distinct strings, sorted | unique_ |
Statistics |
Groups, merges and sets
| You want to | Call | Guide |
|---|---|---|
| A total (sum, mean, count, ...) per key | reduce_ |
Groups, merges and sets |
| The distinct values, with counts, first positions or the inverse | unique |
Groups, merges and sets |
| A group number for every row | group_ |
Groups, merges and sets |
| Merge sorted arrays | kway_ |
Groups, merges and sets |
| Intersection, union, difference | intersect1d, union1d, setdiff1d, setxor1d, set_ |
Groups, merges and sets |
| Which values appear in another array | isin |
Groups, merges and sets |
| Group-by on a pandas / Polars / pyarrow table | kwker.frame.group_ |
DataFrames |
Big and distributed data
| You want to | Call | Guide |
|---|---|---|
| Cap the scratch memory of a thread | set_ |
Large data |
| Pick boundaries for a distributed sort | sample, splitters, splitters_ |
Large data |
| Split data at those boundaries | partition_, partition_, split_ |
Large data |
Special data
| You want to | Call |
|---|---|
| Sort two 4-bit numbers packed per byte (GGML / ONNX layout) | sort_, argsort_, top_ |
| Combine duplicate entries of a sparse COO matrix | coo_ |
| Convert sparse matrices between COO, CSR and CSC | coo_, coo_, csr_, csc_ |
| Order Apache Arrow arrays in place | arrow_, arrow_ (DataFrames) |
| Speed up PyTorch's sorting and selection kernels | kwker.torch_ (PyTorch) |
Calls that put values in order, such as sort, top_k, argsort, rank and searchsorted, take the same two
order options: descending and nans_first. The full list of arguments is in the
Python API reference.
Related
- Quickstart: Kwker Core: the most used calls, runnable in your browser.
- Core concepts: the order rules every operation follows.
- Python API reference: every function with its arguments.