A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: Issue#822 Adjust rows displayed in ui.dataframe (#1288)
RowanBlake43480e7d9c53
diff --git a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsxindex 09ffaec4b9..4372eab7c2 100644--- a/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx+++ b/frontend/src/plugins/impl/data-frames/DataFramePlugin.tsx@@ -27,6 +27,7 @@ interface Data {label?: string | null;columns: ColumnDataTypes;dataframeName: string;+ pageSize: number;}// eslint-disable-next-line @typescript-eslint/consistent-type-definitions@@ -51,6 +52,7 @@ export const DataFramePlugin = createPlugin<S>("marimo-dataframe")z.object({label: z.string().nullish(),dataframeName: z.string(),+ pageSize: z.number().default(5),columns: z.object({}).passthrough()@@ -97,6 +99,7 @@ const EMPTY: Transformations = {export const DataFrameComponent = ({columns,dataframeName,+ pageSize,value,setValue,get_dataframe,@@ -156,7 +159,7 @@ export const DataFrameComponent = ({label={null}className="rounded-b border-x border-b"data={url || ""}- pageSize={5}+ pageSize={pageSize}pagination={true}rowHeaders={row_headers || Arrays.EMPTY}showDownload={false}diff --git a/frontend/src/stories/dataframe.stories.tsx b/frontend/src/stories/dataframe.stories.tsxindex ecd3b76533..33e31e33df 100644--- a/frontend/src/stories/dataframe.stories.tsx+++ b/frontend/src/stories/dataframe.stories.tsx@@ -28,6 +28,7 @@ export const DataFrame: StoryObj = {picture: "bytes",}}dataframeName={"df"}+ pageSize={5}value={value}setValue={(v) => {console.log(v);diff --git a/marimo/_plugins/ui/_impl/dataframes/dataframe.py b/marimo/_plugins/ui/_impl/dataframes/dataframe.pyindex 52d3165706..42ac1e6c88 100644--- a/marimo/_plugins/ui/_impl/dataframes/dataframe.py+++ b/marimo/_plugins/ui/_impl/dataframes/dataframe.py@@ -82,6 +82,7 @@ class dataframe(UIElement[Dict[str, Any], "pd.DataFrame"]):**Initialization Args.**- `df`: the DataFrame or series to transform+ - `page_size`: the number of rows to show in the table"""_name: Final[str] = "marimo-dataframe"@@ -90,6 +91,7 @@ class dataframe(UIElement[Dict[str, Any], "pd.DataFrame"]):self,df: pd.DataFrame,on_change: Optional[Callable[[pd.DataFrame], None]] = None,+ page_size: Optional[int] = 5,) -> None:DependencyManager.require_pandas("to use the dataframe plugin")import pandas as pd@@ -130,6 +132,7 @@ class dataframe(UIElement[Dict[str, Any], "pd.DataFrame"]):"columns": df.dtypes.to_dict(),"dataframe-name": dataframe_name,"total": len(df),+ "page-size": page_size,},functions=(Function(