Closed
Description
Describe the bug
The stubs claim that shift returns None, when it returns a pd.Index of the same type as the original_index
To Reproduce
from datetime import datetime
import pandas as pd
original_index = pd.date_range(
start=datetime(2024, 2, 2),
end=datetime(2024, 4, 2),
freq="15min",
inclusive="left",
tz="Europe/Berlin",
)
new_index = original_index.shift(1)
print(original_index, new_index)
print(f"{type(original_index)}, {type(new_index)}")
I get this mypy error:
example.py:13: error: "shift" of "Index" does not return a value (it only ever returns None) [func-returns-value]
Please complete the following information:
- macOS 15.4 (24E248)
- Python 3.11.11
- I am using mypy 1.11.1 and pandas-stubs 2.2.3.250308.