Query dataframes with GitHub search syntax
Project description
Frame Search
A GitHub search inspired interface to DataFrames.
Powered by narwhals.
Installation
Install from PyPI:
uv add frame-search
Usage
API
Importing frame_search adds a search properties to pandas and polars objects.
# Import to add `search` property to DataFrames
import frame_search # noqa: F401
import polars as pl
df = pl.DataFrame({
"name": ["Alice Smith", "Bob J. Dawkins", "Charlie Brown"],
"age": [25, 30, 35],
"hometown": ["New York", "New York", "Chicago"]
})
df.search('age:<30 hometown:"New York"')
shape: (1, 3)
┌─────────────┬─────┬──────────┐
│ name ┆ age ┆ hometown │
│ --- ┆ --- ┆ --- │
│ str ┆ i64 ┆ str │
╞═════════════╪═════╪══════════╡
│ Alice Smith ┆ 25 ┆ New York │
└─────────────┴─────┴──────────┘
Interactive Search in Marimo Notebooks
Use with marimo to create a search interface for DataFrames:
import marimo as mo
search = mo.ui.text(label="DataFrame Search Query:")
search
Then use on a DataFrame:
import polars as pl
import frame_search # noqa: F401
df = pl.DataFrame({
"name": ["Alice Smith", "Bob J. Dawkins", "Charlie Brown"],
"age": [25, 30, 35],
"hometown": ["New York", "Los Angeles", "Chicago"]
})
df_filter = df.search(search.value)
df_filter
Here is another example in a Marimo notebook:
Search Syntax
The search syntax is inspired by GitHub's search syntax. Here are some resources:
Not all syntax features are currently supported. View the GitHub issues for planned features or to request new ones.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file frame_search-0.3.0.tar.gz.
File metadata
- Download URL: frame_search-0.3.0.tar.gz
- Upload date:
- Size: 10.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
823eebbf3fde95e29fe6ab4bb03695eaa048273cc3eea8677a46473e072b2b3d
|
|
| MD5 |
b251bcef3a99dc5960a773d5f37e1b4d
|
|
| BLAKE2b-256 |
d8002e147154cd9a4b4b162823079fd670ac97f1cc33c92c458a00ae12c92754
|
File details
Details for the file frame_search-0.3.0-py3-none-any.whl.
File metadata
- Download URL: frame_search-0.3.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c0d64fab81a4aa39c34ab3ff5a6b6307b4bb47be727fe2ca661be3501b84abe
|
|
| MD5 |
58486aa06ed11c844c9157b3d0230de3
|
|
| BLAKE2b-256 |
ebfc975ee05bf13a74e79bacc33cd0ff5171e610af4e1d66cb86a09fd881323f
|