Skip to content

Commit 272d674

Browse files
pass through allow dups
1 parent 73d9de2 commit 272d674

File tree

9 files changed

+30
-13
lines changed

9 files changed

+30
-13
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ jobs:
157157
run: |
158158
source activate pandas-dev
159159
pytest pandas/tests/frame/methods --array-manager
160-
pytest pandas/tests/reshape/concat/ --array-manager
160+
pytest pandas/tests/reshape --array-manager

pandas/core/internals/concat.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,12 @@ def concatenate_array_managers(
5959
for mgr, indexers in mgrs_indexers:
6060
for ax, indexer in indexers.items():
6161
mgr = mgr.reindex_indexer(
62-
axes[ax], indexer, axis=ax, do_integrity_check=False, use_na_proxy=True
62+
axes[ax],
63+
indexer,
64+
axis=ax,
65+
allow_dups=True,
66+
do_integrity_check=False,
67+
use_na_proxy=True,
6368
)
6469
mgrs.append(mgr)
6570

pandas/tests/frame/methods/test_explode.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
import numpy as np
22
import pytest
33

4-
import pandas.util._test_decorators as td
5-
64
import pandas as pd
75
import pandas._testing as tm
86

9-
# TODO(ArrayManager) concat reindex with duplicates
10-
pytestmark = td.skip_array_manager_not_yet_implemented
11-
127

138
def test_error():
149
df = pd.DataFrame(

pandas/tests/frame/methods/test_join.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import numpy as np
44
import pytest
55

6-
import pandas.util._test_decorators as td
7-
86
import pandas as pd
97
from pandas import DataFrame, Index, MultiIndex, date_range, period_range
108
import pandas._testing as tm
@@ -180,7 +178,6 @@ def test_join_period_index(frame_with_period_index):
180178
tm.assert_frame_equal(joined, expected)
181179

182180

183-
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) concat with duplicates
184181
def test_join_left_sequence_non_unique_index():
185182
# https://github.com/pandas-dev/pandas/issues/19607
186183
df1 = DataFrame({"a": [0, 10, 20]}, index=[1, 2, 3])

pandas/tests/reshape/merge/test_join.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import numpy as np
22
import pytest
33

4+
import pandas.util._test_decorators as td
5+
46
import pandas as pd
57
from pandas import (
68
Categorical,
@@ -547,6 +549,7 @@ def test_join_non_unique_period_index(self):
547549
)
548550
tm.assert_frame_equal(result, expected)
549551

552+
@td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) groupby
550553
def test_mixed_type_join_with_suffix(self):
551554
# GH #916
552555
df = DataFrame(np.random.randn(20, 6), columns=["a", "b", "c", "d", "e", "f"])

pandas/tests/reshape/merge/test_merge.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import numpy as np
66
import pytest
77

8+
import pandas.util._test_decorators as td
9+
810
from pandas.core.dtypes.common import is_categorical_dtype, is_object_dtype
911
from pandas.core.dtypes.dtypes import CategoricalDtype
1012

@@ -277,6 +279,7 @@ def test_merge_copy(self):
277279
merged["d"] = "peekaboo"
278280
assert (right["d"] == "bar").all()
279281

282+
@td.skip_array_manager_invalid_test # TODO(ArrayManager) join copy behaviour
280283
def test_merge_nocopy(self):
281284
left = DataFrame({"a": 0, "b": 1}, index=range(10))
282285
right = DataFrame({"c": "foo", "d": "bar"}, index=range(10))
@@ -656,7 +659,7 @@ def _constructor(self):
656659

657660
assert isinstance(result, NotADataFrame)
658661

659-
def test_join_append_timedeltas(self):
662+
def test_join_append_timedeltas(self, using_array_manager):
660663
# timedelta64 issues with join/merge
661664
# GH 5695
662665

@@ -670,6 +673,8 @@ def test_join_append_timedeltas(self):
670673
"t": [timedelta(0, 22500), timedelta(0, 22500)],
671674
}
672675
)
676+
if using_array_manager:
677+
expected = expected.astype(object)
673678
tm.assert_frame_equal(result, expected)
674679

675680
td = np.timedelta64(300000000)
@@ -1362,6 +1367,7 @@ def test_merge_take_missing_values_from_index_of_other_dtype(self):
13621367
expected = expected.reindex(columns=["a", "key", "b"])
13631368
tm.assert_frame_equal(result, expected)
13641369

1370+
@td.skip_array_manager_invalid_test # TODO(ArrayManager) rewrite test
13651371
def test_merge_readonly(self):
13661372
# https://github.com/pandas-dev/pandas/issues/27943
13671373
data1 = DataFrame(

pandas/tests/reshape/test_crosstab.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import numpy as np
22
import pytest
33

4+
import pandas.util._test_decorators as td
5+
46
from pandas.core.dtypes.common import is_categorical_dtype
57

68
from pandas import CategoricalIndex, DataFrame, Index, MultiIndex, Series, crosstab
79
import pandas._testing as tm
810

11+
pytestmark = td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) groupby
12+
913

1014
class TestCrosstab:
1115
def setup_method(self, method):

pandas/tests/reshape/test_pivot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import numpy as np
55
import pytest
66

7+
import pandas.util._test_decorators as td
8+
79
import pandas as pd
810
from pandas import (
911
Categorical,
@@ -19,6 +21,8 @@
1921
from pandas.api.types import CategoricalDtype as CDT
2022
from pandas.core.reshape.pivot import pivot_table
2123

24+
pytestmark = td.skip_array_manager_not_yet_implemented # TODO(ArrayManager) groupby
25+
2226

2327
@pytest.fixture(params=[True, False])
2428
def dropna(request):

pandas/tests/reshape/test_pivot_multilevel.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_pivot_list_like_columns(
192192
tm.assert_frame_equal(result, expected)
193193

194194

195-
def test_pivot_multiindexed_rows_and_cols():
195+
def test_pivot_multiindexed_rows_and_cols(using_array_manager):
196196
# GH 36360
197197

198198
df = pd.DataFrame(
@@ -214,11 +214,14 @@ def test_pivot_multiindexed_rows_and_cols():
214214
)
215215

216216
expected = pd.DataFrame(
217-
data=[[5.0, np.nan], [10.0, 7.0]],
217+
data=[[5, np.nan], [10, 7.0]],
218218
columns=MultiIndex.from_tuples(
219219
[(0, 1, 0), (0, 1, 1)], names=["col_L0", "col_L1", "idx_L1"]
220220
),
221221
index=Int64Index([0, 1], dtype="int64", name="idx_L0"),
222222
)
223+
if not using_array_manager:
224+
# BlockManager does not preserve the dtypes
225+
expected = expected.astype("float64")
223226

224227
tm.assert_frame_equal(res, expected)

0 commit comments

Comments
 (0)