diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 9624b1308239c..f3d7c48c7d1f1 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -3341,10 +3341,18 @@ def where(self, cond, other=np.nan, inplace=False, axis=None, level=None, matches = (new_other == np.array(other)) if matches is False or not matches.all(): - other = np.array(other) + + # coerce other to a common dtype if we can + if com.needs_i8_conversion(self.dtype): + try: + other = np.array(other, dtype=self.dtype) + except: + other = np.array(other) + else: + other = np.asarray(other) + other = np.asarray(other, dtype=np.common_type(other, new_other)) - # we can't use our existing dtype - # because of incompatibilities + # we need to use the new dtype try_quick = False else: other = new_other diff --git a/pandas/tests/test_frame.py b/pandas/tests/test_frame.py index c001f35ab65cc..a35e03d53cb31 100644 --- a/pandas/tests/test_frame.py +++ b/pandas/tests/test_frame.py @@ -14231,7 +14231,8 @@ class SubclassedPanel(Panel): self.assertTrue(isinstance(result, SubclassedPanel)) expected = SubclassedPanel([[[1, 2, 3]], [[4, 5, 6]]], items=['X', 'Y'], major_axis=[0], - minor_axis=[0, 1, 2]) + minor_axis=[0, 1, 2], + dtype='int64') tm.assert_panel_equal(result, expected) diff --git a/pandas/tests/test_util.py b/pandas/tests/test_util.py index bb8bd3df96b71..38f058358b37f 100644 --- a/pandas/tests/test_util.py +++ b/pandas/tests/test_util.py @@ -3,6 +3,7 @@ import nose +import sys import pandas.util from pandas.util.decorators import deprecate_kwarg import pandas.util.testing as tm @@ -80,6 +81,9 @@ def test_warning(self): self.assertNotAlmostEquals(1, 2) def test_locale(self): + if sys.platform == 'win32': + raise nose.SkipTest("skipping on win platforms as locale not available") + #GH9744 locales = pandas.util.testing.get_locales() self.assertTrue(len(locales) >= 1) diff --git a/setup.py b/setup.py index 8066a6e0cae4f..f0090aff31430 100755 --- a/setup.py +++ b/setup.py @@ -602,7 +602,7 @@ def pxd(name): ], package_data={'pandas.io': ['tests/data/legacy_hdf/*.h5', 'tests/data/legacy_pickle/*/*.pickle', - 'tests/data/*.csv', + 'tests/data/*.csv*', 'tests/data/*.dta', 'tests/data/*.txt', 'tests/data/*.xls',