Skip to main content

Query dataframes with GitHub search syntax

Project description

Frame Search

Ruff Tests PyPI version

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:

Marimo Example

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

frame_search-0.3.0.tar.gz (10.7 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frame_search-0.3.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

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

Hashes for frame_search-0.3.0.tar.gz
Algorithm Hash digest
SHA256 823eebbf3fde95e29fe6ab4bb03695eaa048273cc3eea8677a46473e072b2b3d
MD5 b251bcef3a99dc5960a773d5f37e1b4d
BLAKE2b-256 d8002e147154cd9a4b4b162823079fd670ac97f1cc33c92c458a00ae12c92754

See more details on using hashes here.

File details

Details for the file frame_search-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for frame_search-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c0d64fab81a4aa39c34ab3ff5a6b6307b4bb47be727fe2ca661be3501b84abe
MD5 58486aa06ed11c844c9157b3d0230de3
BLAKE2b-256 ebfc975ee05bf13a74e79bacc33cd0ff5171e610af4e1d66cb86a09fd881323f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page