-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: limit / specify number of rows to display #253
Comments
Thanks for the interest. Try this code snippet out. I will definitely modify the I could add an option for configuring sampling behavor, but for now I'd like to wait. you can write your own utility function to build a from buckaroo.buckaroo_widget import RawDFViewerWidget, BuckarooWidget
from buckaroo.dataflow.widget_extension_utils import (configure_buckaroo)
from buckaroo.dataflow.dataflow_extras import Sampling
def DFViewer(df,
column_config_overrides=None,
extra_pinned_rows=None, pinned_rows=None,
extra_analysis_klasses=None, analysis_klasses=None,
widget_klass=BuckarooWidget):
"""
Display a DataFrame with buckaroo styling and analysis, no extra UI pieces
column_config_overrides allows targetted specific overriding of styling
extra_pinned_rows adds pinned_rows of summary stats
pinned_rows replaces the default pinned rows
extra_analysis_klasses adds an analysis_klass
analysis_klasses replaces default analysis_klass
"""
BuckarooKls = configure_buckaroo(
widget_klass,
extra_pinned_rows=extra_pinned_rows, pinned_rows=pinned_rows,
extra_analysis_klasses=extra_analysis_klasses, analysis_klasses=analysis_klasses)
bw = BuckarooKls(df, column_config_overrides=column_config_overrides)
dfv_config = bw.df_display_args['dfviewer_special']['df_viewer_config']
df_data = bw.df_data_dict['main']
summary_stats_data = bw.df_data_dict['all_stats']
return RawDFViewerWidget(
df_data=df_data, df_viewer_config=dfv_config, summary_stats_data=summary_stats_data)
df = pd.DataFrame({'a':[10, 20, 339, 887], 'b': ['foo', 'bar', None, 'baz']})
#DFViewer(df)
class TwoSample(Sampling):
pre_limit = 5
max_columns = 1
serialize_limit = 2
class TwoBuckaroo(BuckarooWidget):
sampling_klass = TwoSample
DFViewer(df, widget_klass=TwoBuckaroo) |
Appreciate the speedy response! I did try out the code snippet you shared, and while it looked promising, I wasn't able to produce the behavior I was looking for. Playing with Ex: import pandas as pd
df = pd.DataFrame({"a": range(300), "b": ["c" * i for i in range(300)]})
df import polars as pl
pl.from_dataframe(df) import buckaroo
df show all 300 rows, with summary stats over all 300 rows. |
So far as customizing the default display behavior. I love that you want to do this. It's exactly how I want people to use Buckaroo, customize it with their own opinions, and make it do the thing you want by default. There are a couple of ways to get the behavior that you want, all that will require some dev work on my end.
Why don't you work on some of the customizations available now, and we'll look at these options in future releases. BTW, If you're up for it, I'd love to talk to you about how you're using Buckaroo. contact me offline, my info is available in my github profile. |
Thank you so much! I'll definitely follow up with you on this! |
How has this solution been working for you? |
Closing because of no further comment |
Checks
How would you categorize this request. You can select multiple if not sure
Display (is this related to visual display of a value)
Enhancement Description
As far as I understand, currently Data Frames are displayed in their entirety up to 10k rows, after which they are sampled to 10k rows and displayed.
This request is looking for argument to
DFViewer
, or wherever makes the most sense, to limit the number of rows displayed to somen
, where 10k >n
>1.While I understand that its possible to call
DFViewer(df.head(10))
to only display 10 rows, this also only provides summary stats over those 10 rows. This request is looking for some behavior like below:If this is already possible my apologies.
Appreciative of this great tool!
Pseudo Code Implementation
NA
Prior Art
NA
The text was updated successfully, but these errors were encountered: