Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion buckaroo/polars_buckaroo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,27 @@
from .dataflow.dataflow import Sampling
from .dataflow.autocleaning import PandasAutocleaning
from .dataflow.widget_extension_utils import configure_buckaroo
from .styling_helpers import obj_, pinned_histogram, pinned_filtered_histogram

class PLSampling(Sampling):
pre_limit = False
serialize_limit = 1_000_000

local_analysis_klasses = list(PL_ANALYSIS_V2) + [DefaultSummaryStatsStyling, DefaultMainStyling]

class PolarsMainStyling(DefaultMainStyling):
"""Polars default styling — adds an optional ``?filtered_histogram``
pinned row alongside the bare raw ``histogram``. The ``?`` prefix
means JS only renders the row when at least one column has the
``filtered_histogram`` key in ``merged_sd``, i.e. when a search
filter is active. Polars materialises the filt scope cheaply, so
showing both raw and filtered histograms side-by-side is the
default; xorq skips computing filtered_histogram (#829) and pandas
keeps the original ``[dtype, histogram]`` layout."""

pinned_rows = [obj_('dtype'), pinned_histogram(), pinned_filtered_histogram()]


local_analysis_klasses = list(PL_ANALYSIS_V2) + [DefaultSummaryStatsStyling, PolarsMainStyling]


class PolarsAutocleaning(PandasAutocleaning):
Expand Down
3 changes: 3 additions & 0 deletions buckaroo/styling_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ def inherit_(pkey):

def pinned_histogram():
return {'primary_key_val': 'histogram', 'displayer_args': {'displayer': 'histogram'}}

def pinned_filtered_histogram():
return {'primary_key_val': '?filtered_histogram', 'displayer_args': {'displayer': 'histogram'}}
Loading