BUG: Series.combine_first raises ValueError on mixed-timezone datetime-index #26283
Labels
Bug
Datetime
Datetime data dtype
Needs Tests
Unit test(s) needed to prevent regressions
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Timezones
Timezone data dtype
Problem description
left.combine_first(right)
unexpectedly raises aValueError
if:left
has a timezone-aware datetime index, with the same timezone throughout the index.right
has a timezone-aware datetime index, with a mix of different timezones.The traceback is as follows:
If the same arguments are swapped, i.e.
right.combine_first(left)
, no error is raised, and the output is as expected (timestamps which are equal but in different timezones are identified, with the left argument's timezone propagating into the output).The error also doesn't occur at all with the same setup on DataFrames.
It doesn't seem to me that there's any semantic reason that the operation should fail, so this appears to be a bug.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Darwin
OS-release: 17.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
pandas: 0.24.2
pytest: 4.3.1
pip: 19.0.3
setuptools: 40.8.0
Cython: None
numpy: 1.16.3
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.8.0
pytz: 2018.9
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: None
sqlalchemy: 1.3.3
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None
The text was updated successfully, but these errors were encountered: