perspective-dev/perspective · error · TypeError

Index and Limit cannot be set at the same time!

Error message

Index and Limit cannot be set at the same time!

What it means

PerspectiveWidget.__init__ accepts mutually exclusive windowing options: `index` (window from a row offset) and `limit` (window of N rows). Passing both is ambiguous — the table cannot apply two windowing strategies — so construction is rejected before the table is loaded.

Solutions

  1. Pass only one of index or limit, not both
  2. Choose limit for a fixed-size recent-rows window, index for streaming from an offset
  3. Set the other option to None (its default)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at rust/perspective-python/perspective/widget/__init__.py:181 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of perspective-dev/perspective@11c8238c0c (2026-09-09). Data as JSON: /api/errors/8d52462b769f52f2. Report an issue: GitHub.

Appendix: source

Thrown at rust/perspective-python/perspective/widget/__init__.py:181

        # Examples

        >>> widget = PerspectiveWidget(
        ...     {"a": [1, 2, 3]},
        ...     aggregates={"a": "avg"},
        ...     group_by=["a"],
        ...     sort=[["b", "desc"]],
        ...     filter=[["a", ">", 1]],
        ...     expressions=["\"a\" + 100"])
        """

        self.binding_mode = binding_mode

        # Pass table load options to the front-end, unless in server mode
        self._options = {}

        if index is not None and limit is not None:
            raise TypeError("Index and Limit cannot be set at the same time!")

        # Parse the dataset we pass in - if it's Pandas, preserve pivots
        # if isinstance(data, pandas.DataFrame) or isinstance(data, pandas.Series):
        #     data, config = deconstruct_pandas(data)

        #     if config.get("group_by", None) and "group_by" not in kwargs:
        #         kwargs.update({"group_by": config["group_by"]})

        #     if config.get("split_by", None) and "split_by" not in kwargs:
        #         kwargs.update({"split_by": config["split_by"]})

        #     if config.get("columns", None) and "columns" not in kwargs:
        #         kwargs.update({"columns": config["columns"]})

        # Initialize the viewer
        super(PerspectiveWidget, self).__init__(**kwargs)

        # Handle messages from the the front end

View on GitHub (pinned to 11c8238c0c)