-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: freq
attribute is None
after set_index
#42747
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
Thanks @antvig for the report.
first bad commit: [6b6d8fd] REF: Back DatetimeTZBlock with sometimes-2D DTA (#41082) cc @jbrockmendel |
This behavior matches what happens with tznaive DTI (which i think theres an issue about), is unavoidable |
changing milestone to 1.3.5 |
@simonjayhawkins there's essentially no prospect for this to change for 1.3.5 |
Can you elaborate. Is the new behavior considered correct? If not, why can't this be fixed. |
good to fix but not needed for 1.3.x |
The changed behavior is driven by the fact that when you do reset_index with a DTI/TDI, it is unwrapped to DTA/TDA to become a column and reshaped to 2D. 2D DTA/TDA never have non-None freq. We could "cheat" here since it is single-column and retain the freq, but that would only be until 2.0 when DTA/TDA will lost the freq attr entirely (xref #31218) |
moving off 1.3.x milestone |
I have checked that this issue has not already been reported.
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
This behavior is new in
1.3.0
and1.3.1
.In
1.2.5
, the output was, as expected,H
Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : c7f7443
python : 3.8.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 158 Stepping 13, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : fr_FR.cp1252
pandas : 1.3.1
numpy : 1.21.1
pytz : 2021.1
dateutil : 2.8.2
pip : 21.1.3
setuptools : 57.4.0
Cython : None
pytest : 6.2.4
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
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.7.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: