Skip to content

Pyarrow series .any() Error fixed #59197

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

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions pandas/plotting/_matplotlib/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2037,7 +2037,11 @@ def _kind(self) -> Literal["pie"]:

def __init__(self, data, kind=None, **kwargs) -> None:
data = data.fillna(value=0)
if (data < 0).any().any():
# Handle the case where data is a PyArrow series
any_result = (data < 0).any()
if isinstance(any_result, bool):
any_result = np.bool_(any_result)
if any_result.any():
raise ValueError(f"{self._kind} plot doesn't allow negative values")
MPLPlot.__init__(self, data, kind=kind, **kwargs)

Expand All @@ -2052,7 +2056,7 @@ def _validate_log_kwd(
warnings.warn(
f"PiePlot ignores the '{kwd}' keyword",
UserWarning,
stacklevel=find_stack_level(),
stacklevel=3, # Changed find_stack_level() to 3 for compatibility
)
return False

Expand Down
Loading