Skip to content

ENH: do not convert mixed-integer type indexes to datetimeindex #3878

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

Merged
merged 2 commits into from
Jun 13, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ pandas 0.11.1
- Added Faq section on repr display options, to help users customize their setup.
- ``where`` operations that result in block splitting are much faster (GH3733_)
- Series and DataFrame hist methods now take a ``figsize`` argument (GH3834_)
- DatetimeIndexes no longer try to convert mixed-integer indexes during join
operations (GH3877_)

**API Changes**

Expand Down Expand Up @@ -317,6 +319,7 @@ pandas 0.11.1
.. _GH3814: https://github.com/pydata/pandas/issues/3814
.. _GH3834: https://github.com/pydata/pandas/issues/3834
.. _GH3873: https://github.com/pydata/pandas/issues/3873
.. _GH3877: https://github.com/pydata/pandas/issues/3877


pandas 0.11.0
Expand Down
3 changes: 3 additions & 0 deletions doc/source/v0.11.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ Enhancements
dff.groupby('B').filter(lambda x: len(x) > 2, dropna=False)

- Series and DataFrame hist methods now take a ``figsize`` argument (GH3834_)
- DatetimeIndexes no longer try to convert mixed-integer indexes during join
operations (GH3877_)


Bug Fixes
Expand Down Expand Up @@ -402,3 +404,4 @@ on GitHub for a complete list.
.. _GH3425: https://github.com/pydata/pandas/issues/3425
.. _GH3834: https://github.com/pydata/pandas/issues/3834
.. _GH3873: https://github.com/pydata/pandas/issues/3873
.. _GH3877: https://github.com/pydata/pandas/issues/3877
3 changes: 2 additions & 1 deletion pandas/tseries/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,8 @@ def join(self, other, how='left', level=None, return_indexers=False):
"""
See Index.join
"""
if not isinstance(other, DatetimeIndex) and len(other) > 0:
if (not isinstance(other, DatetimeIndex) and len(other) > 0 and
other.inferred_type != 'mixed-integer'):
try:
other = DatetimeIndex(other)
except TypeError:
Expand Down
9 changes: 8 additions & 1 deletion pandas/tseries/tests/test_timeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import pandas.core.datetools as datetools
import pandas.tseries.offsets as offsets
import pandas.tseries.frequencies as fmod
from pandas.tseries.index import TimeSeriesError
import pandas as pd

from pandas.util.testing import assert_series_equal, assert_almost_equal
Expand Down Expand Up @@ -1853,6 +1852,14 @@ def test_date(self):
expected = [t.date() for t in rng]
self.assert_((result == expected).all())

def test_does_not_convert_mixed_integer(self):
df = tm.makeCustomDataframe(10, 10, data_gen_f=lambda *args, **kwargs:
randn(), r_idx_type='i', c_idx_type='dt')
cols = df.columns.join(df.index, how='outer')
joined = cols.join(df.columns)
self.assertEqual(cols.dtype, np.dtype('O'))
self.assertEqual(cols.dtype, joined.dtype)
self.assert_(np.array_equal(cols.values, joined.values))

class TestLegacySupport(unittest.TestCase):
_multiprocess_can_split_ = True
Expand Down