Skip to content
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

Fixed: add missing max_rows parameter to add_df_index function #261

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/ipyvizzu/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,8 @@ def add_df(
The default measure value to fill empty values. Defaults to 0.
default_dimension_value:
The default dimension value to fill empty values. Defaults to an empty string.
max_rows: The maximum number of rows to include in the converted series list.
max_rows:
The maximum number of rows to include in the converted series list.
If the `df` contains more rows,
a random sample of the given number of rows (approximately) will be taken.
include_index:
Expand Down Expand Up @@ -383,6 +384,7 @@ def add_df_index(
self,
df: Optional[Union["pandas.DataFrame", "pandas.Series"]], # type: ignore
column_name: str = "Index",
max_rows: int = MAX_ROWS,
) -> None:
"""
Add the index of a `pandas` `DataFrame` as a series to an existing
Expand All @@ -393,6 +395,10 @@ def add_df_index(
The `pandas` `DataFrame` or `Series` from which to extract the index.
column_name:
Name for the index column to add as a series.
max_rows:
The maximum number of rows to include in the converted series list.
If the `df` contains more rows,
a random sample of the given number of rows (approximately) will be taken.

Example:
Adding a data frame's index to a
Expand All @@ -408,7 +414,9 @@ def add_df_index(
"""

if not isinstance(df, type(None)):
converter = PandasDataFrameConverter(df, include_index=column_name)
converter = PandasDataFrameConverter(
df, max_rows=max_rows, include_index=column_name
)
series_list = converter.get_series_from_index()
self.add_series_list(series_list)

Expand Down