dr_frames
Pandas/DataFrame utilities for data manipulation, filtering, aggregation, and schema management.
Primitive quick reference for agents:
primitives.columns:rename_columns,move_cols_to_beginning,strip_col_prefixes,drop_all_null_cols,drop_all_constant_cols,get_cols_by_prefix,get_cols_by_contains,move_cols_with_prefix_to_end,move_numeric_cols_to_endprimitives.filtering:select_subset,filter_to_values,filter_to_range,make_filter_fxnprimitives.ranking:select_best_by_metricprimitives.coerce:coerce_numeric_cols,coerce_string_colsprimitives.aggregation:aggregate_over_seeds,aggregate_by_groupprimitives.missing:fill_missing_valuesprimitives.masked:masked_getter,masked_setterprimitives.constant:get_constant_cols,get_groupwise_constant_colsprimitives.unique:unique_non_null,unique_by_col,unique_by_colsprimitives.namespaced:group_namespaced_valuesprimitives.pipeline:maybe_pipeprimitives.parsing:parse_list_string
Installation
uv add dr-frames
Quick Start
import pandas as pd
from dr_frames import (
coerce_numeric_cols,
filter_to_range,
move_cols_to_beginning,
select_subset,
)
df = pd.DataFrame({
"name": ["alice", "bob", "charlie"],
"value": ["1.0", "2.0", "3.0"],
"category": ["x", "y", "x"],
})
result = (
df.pipe(coerce_numeric_cols, ["value"])
.pipe(select_subset, {"category": "x"})
.pipe(filter_to_range, "value", 0.5, 2.5)
)
Flexible Schema
flexible_schema is the higher-level part of the library for working with
dataframes whose columns you did not design yourself.
DataFielddescribes a logical field and can resolve which dataframe column it maps to.ComputedFielddescribes a derived field that should be added from existing columns before downstream use.MetricDataFielddescribes metric columns, especially prefixed metric names such aseval/....DataFormatis the container that ties those pieces together and gives you a reusable view of a dataframe schema.
Typical usage:
- build a
DataFormatfrom a dataframe withDataFormat.from_df(...)or from a field-description mapping withDataFormat.from_dict(...) - inspect unresolved fields and discovered metrics
- add computed fields for columns you want to derive once and reuse
- call
prepare_for_plotting(...)to produce a dataframe restricted to the known fields, computed fields, and metrics - use
metric_col(...),get_metric(...), andget_config_columns(...)to drive plotting or grouped analysis code without hardcoding raw column names
Minimal example:
from dr_frames import ComputedField, DataField, DataFormat
fmt = DataFormat(
fields=[
DataField(id_string="model", column_name="model_name"),
DataField(id_string="dataset"),
],
computed_fields=[
ComputedField(
id_string="is_large",
source_columns=["params_millions"],
compute=lambda df: df["params_millions"] > 1000,
)
],
)
plot_df = fmt.prepare_for_plotting(df)
config_cols = fmt.get_config_columns()
License
MIT
Metadata
Release files for dr-frames 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dr_frames-0.1.2.tar.gz | 45.8 kB | Without provenance | Details for dr_frames-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dr_frames-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for dr_frames-0.1.2-py3-none-any.whl |
Total release size: 64.5 kB
Release files / dr_frames-0.1.2.tar.gz
| Download URL | dr_frames-0.1.2.tar.gz |
|---|---|
| Size | 45.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
56cec71912401f388ff16bb75213204b01b66185f100ae9c181867d51eed30b8
|
|
BLAKE2b-256 checksum How to use checksums |
dcb34e492619dac730038c939728753ae3dfeab54211790c39a7c985c027a90b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.0
|
Release files / dr_frames-0.1.2-py3-none-any.whl
| Download URL | dr_frames-0.1.2-py3-none-any.whl |
|---|---|
| Size | 18.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8ea85e733003427068b356367c8c894f07ef99f98fa70c40cb43fd637f78e92c
|
|
BLAKE2b-256 checksum How to use checksums |
b9100266abcfdd74bfaa0b9a6f900018e6425f4207c710620734ec6d70e2ce1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.0
|
Security for dr-frames 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.