-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: pd.DateOffset(n) doesn't add days to pd.Series or pd.DatetimeIndex #45643
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
You have to tell the offset what unit to add, try pd.DateOffset(days=1) |
Ah yeah indeed ! 😄 But no depreciation warning was raised, when sometimes future argument behavior changing had raised depreciation warning. Is that normal ? |
And more, pd.DateOffset(1) worked for date (not vector), that's strange .. |
Can not help you there. I do not use DateOffset with n myself |
I encountered the same problem. Since I can't actually reopen this issue I opened #45890. As @wenceslas-sanchez said something strange has happened and we need to figure out why. |
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
pd.DateOffset(n) doesn't add days to pd.Series or DatetimeIndex like pandas==1.3.5.
Expected Behavior
With pandas==1.3.5, pd.DateOffset(n) should add n days to a vector (pd.Series or DatetimeIndex) /date. But with pandas==1.4.0, it works for date but not for vectors.
You can test it with the reproductible code with pandas version 1.4.0 and 1.3.5 :
version 1.3.5 :
version 1.4.0 :
Installed Versions
INSTALLED VERSIONS
commit : bb1f651
python : 3.9.7.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19043
machine : AMD64
processor : Intel64 Family 6 Model 165 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.4.0
numpy : 1.22.1
pytz : 2021.3
dateutil : 2.8.2
pip : 21.2.4
setuptools : 58.0.4
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : None
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: