BUG: DataFrame and Series constructor inconsistent in handling of Datetimelike object index #39307
Closed
3 tasks done
Labels
Constructors
Series/DataFrame/Index/pd.array Constructors
Datetime
Datetime data dtype
Deprecate
Functionality to remove in pandas
Index
Related to the Index class or subclasses
Milestone
I have checked that this issue has not already been reported. (Looked through and could not find anything)
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 behavior should be consistent, but not sure what to expected here. The inference is a nice feature although.
The current behavior leads to weird situations with indexing:
works while
Expected Output
Bot returning the same index dtype
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : ff628b1
python : 3.8.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.8.0-38-generic
Version : #43~20.04.1-Ubuntu SMP Tue Jan 12 16:39:47 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.3.0.dev0+483.gff628b17cc.dirty
numpy : 1.21.0.dev0+438.gbf4ac1f81
pytz : 2020.1
dateutil : 2.8.1
pip : 20.2.3
setuptools : 49.6.0.post20201009
Cython : 0.29.21
pytest : 6.1.1
hypothesis : 5.37.1
sphinx : 3.4.3
blosc : None
feather : None
xlsxwriter : 1.3.7
lxml.etree : 4.5.2
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 2.11.2
IPython : 7.18.1
pandas_datareader: None
bs4 : 4.9.3
bottleneck : 1.3.2
fsspec : 0.8.3
fastparquet : 0.4.1
gcsfs : 0.7.1
matplotlib : 3.3.2
numexpr : 2.7.1
odfpy : None
openpyxl : 3.0.5
pandas_gbq : None
pyarrow : 2.0.0
pyxlsb : None
s3fs : 0.4.2
scipy : 1.7.0.dev0+5e9eb01
sqlalchemy : 1.3.20
tables : 3.6.1
tabulate : 0.8.7
xarray : 0.16.1
xlrd : 1.2.0
xlwt : 1.3.0
numba : 0.51.2
The text was updated successfully, but these errors were encountered: