BUG: Series.mod behaves different with >1e4 rows · Issue #36047 · pandas-dev/pandas (original) (raw)


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