Consistent dtype output for element wise operations on empty dataframes #32802
Labels
API - Consistency
Internal Consistency of API/Behavior
Bug
Dtype Conversions
Unexpected or buggy dtype conversions
Numeric Operations
Arithmetic, Comparison, and Logical operations
Code Sample, a copy-pastable example if possible
Problem description
When dataframe is empty, doing a
.min(axis=1)
outputs a series of dtypefloat64
even though all columns were dtypedatetime64
.Should this be consitent on dtypes and output
min_dates
with dtypedatetime64[ns, UTC]
.This is only an issue when the dataframe is empty.
If the dataframe is not empty, the dtype is conserved and min_dates outputs with dtype
datetime64[ns, UTC]
.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.3.final.0
python-bits : 64
OS : Linux
OS-release : 3.10.0-862.3.3.el7.x86_64
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 1.0.2
numpy : 1.16.5
pytz : 2019.3
dateutil : 2.8.0
pip : 20.0.2
setuptools : 41.4.0
Cython : 0.29.13
pytest : 5.0.1
hypothesis : None
sphinx : 2.1.2
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.3 (dt dec pq3 ext lo64)
jinja2 : 2.10.1
IPython : 7.7.0
pandas_datareader: None
bs4 : 4.8.1
bottleneck : None
fastparquet : None
gcsfs : 0.3.1
lxml.etree : None
matplotlib : 3.1.1
numexpr : 2.6.9
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 5.0.1
pyxlsb : None
s3fs : None
scipy : 1.3.1
sqlalchemy : 1.3.8
tables : 3.5.2
tabulate : None
xarray : 0.14.0
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
numba : 0.46.0
The text was updated successfully, but these errors were encountered: