BUG: series.truncate doesn't return the correct value in pandas 1.1.0 #35544
Labels
Bug
Indexing
Related to indexing on series/frames, not to indexes themselves
Regression
Functionality that used to work in a prior pandas version
Milestone
[Y] I have checked that this issue has not already been reported.
[Y] 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
Problem description
The above test passes in pandas 1.0.5 while fails in pandas 1.1.0.
After diving into the code I found that truncate in pandas/core/generic.py changed as follows:
the above check was added to the method.
ax.is_monotonic_decreasing
returns true for 1-element series, (ax.is_monotonic_increasing
also returns true). When before, and after are given in the correct, increasing order (like in the test), the following check reverses them and the result of truncate will be an empty series, instead of returning the input series which is the expected behaviour.The text was updated successfully, but these errors were encountered: