Skip to main content

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:

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.2.0.tar.gz (198.9 kB 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.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file frame_search-0.2.0.tar.gz.

File metadata

  • Download URL: frame_search-0.2.0.tar.gz
  • Upload date:
  • Size: 198.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.8.8

File hashes

Hashes for frame_search-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8949598a89d296460c864c73c4b4a3733490a576c9daae7cafcaf1574904403b
MD5 b8f1fa17dd57aa68abbc3ed9478739df
BLAKE2b-256 7af28b7e215112b017b000906201248cc37be7af2c97fb257eb273aa8aaeff59

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for frame_search-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8d40563513984f41ee08df912d160585ba371a7360221798fa93059d5394617
MD5 61b396155d00e2253add90ec8bae8248
BLAKE2b-256 cfad262b4039fc0aab36f0e4841f01bdf1151f2f0cab32f3cb8e23966a1f081b

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