Skip to content

BUG: Series.__mod__ behaves different with >1e4 rows #36047

Closed
@river-00

Description

@river-00
  • [√] I have checked that this issue has not already been reported.

  • [√] I have confirmed this bug exists on the latest version of pandas.

  • (optional) I have confirmed this bug exists on the master branch of pandas.


Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.

Code Sample, a copy-pastable example

# Your code here
import pandas as pd
ts = pd.Series([-2,-2,-2])
ts = pd.concat(5000 * [ts])
(ts[:10001]%4).iloc[-1]
(ts[:10000]%4).iloc[-1]

Gives
-2
2

Problem description

According to basic python module operations and previous versions of pandas, the module operation should always give a non-negative value, but when a Series larger than 10000 rows, the negative value module array operation gives a negative value.

Expected Output

2
2

Output of pd.show_versions()

1.1.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNumeric OperationsArithmetic, Comparison, and Logical operationsRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions