We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50386d8 commit e96a9a0Copy full SHA for e96a9a0
pandas/core/arrays/datetimes.py
@@ -2756,7 +2756,10 @@ def _generate_range(
2756
if start and not offset.is_on_offset(start):
2757
# Incompatible types in assignment (expression has type "datetime",
2758
# variable has type "Optional[Timestamp]")
2759
- start = offset.rollforward(start) # type: ignore[assignment]
+ if offset.n >= 0:
2760
+ start = offset.rollforward(start) # type: ignore[assignment]
2761
+ else:
2762
+ start = offset.rollback(start) # type: ignore[assignment]
2763
2764
# Unsupported operand types for < ("Timestamp" and "None")
2765
if periods is None and end < start and offset.n >= 0: # type: ignore[operator]
0 commit comments