|
1 | 1 | from warnings import catch_warnings, simplefilter
|
2 | 2 | from itertools import combinations
|
3 | 3 | from collections import deque
|
| 4 | +from decimal import Decimal |
4 | 5 |
|
5 | 6 | import datetime as dt
|
6 | 7 | import dateutil
|
7 | 8 | import numpy as np
|
8 | 9 | from numpy.random import randn
|
9 | 10 |
|
10 | 11 | from datetime import datetime
|
11 |
| -from pandas.compat import StringIO, iteritems, PY2 |
| 12 | +from pandas.compat import Iterable, StringIO, iteritems, PY2 |
12 | 13 | import pandas as pd
|
13 | 14 | from pandas import (DataFrame, concat,
|
14 | 15 | read_csv, isna, Series, date_range,
|
15 | 16 | Index, Panel, MultiIndex, Timestamp,
|
16 | 17 | DatetimeIndex, Categorical)
|
17 |
| -from pandas.compat import Iterable |
18 | 18 | from pandas.core.dtypes.dtypes import CategoricalDtype
|
19 | 19 | from pandas.util import testing as tm
|
20 | 20 | from pandas.util.testing import (assert_frame_equal,
|
21 | 21 | makeCustomDataframe as mkdf)
|
| 22 | +from pandas.tests.extension.decimal import to_decimal |
22 | 23 |
|
23 | 24 | import pytest
|
24 | 25 |
|
@@ -2361,6 +2362,18 @@ def test_concat_datetime_timezone(self):
|
2361 | 2362 | index=idx1.append(idx1))
|
2362 | 2363 | tm.assert_frame_equal(result, expected)
|
2363 | 2364 |
|
| 2365 | + @pytest.mark.skipif(PY2, reason="Unhashable Decimal dtype") |
| 2366 | + def test_concat_different_extension_dtypes_upcasts(self): |
| 2367 | + a = pd.Series(pd.core.arrays.integer_array([1, 2])) |
| 2368 | + b = pd.Series(to_decimal([1, 2])) |
| 2369 | + |
| 2370 | + result = pd.concat([a, b], ignore_index=True) |
| 2371 | + expected = pd.Series([ |
| 2372 | + 1, 2, |
| 2373 | + Decimal(1), Decimal(2) |
| 2374 | + ], dtype=object) |
| 2375 | + tm.assert_series_equal(result, expected) |
| 2376 | + |
2364 | 2377 |
|
2365 | 2378 | @pytest.mark.parametrize('pdt', [pd.Series, pd.DataFrame, pd.Panel])
|
2366 | 2379 | @pytest.mark.parametrize('dt', np.sctypes['float'])
|
|
0 commit comments