Skip to content

Commit 10d4da0

Browse files
committed
Partly solve pandas-dev#23558
1 parent 03cb788 commit 10d4da0

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

pandas/_libs/lib.pyx

+8
Original file line numberDiff line numberDiff line change
@@ -2258,6 +2258,8 @@ def tuples_to_object_array(ndarray[object] tuples):
22582258
result = np.empty((n, k), dtype=object)
22592259
for i in range(n):
22602260
tup = tuples[i]
2261+
if checknull(tup):
2262+
continue
22612263
for j in range(k):
22622264
result[i, j] = tup[j]
22632265

@@ -2274,6 +2276,8 @@ def to_object_array_tuples(rows: list):
22742276

22752277
k = 0
22762278
for i in range(n):
2279+
if checknull(rows[i]):
2280+
continue
22772281
tmp = len(rows[i])
22782282
if tmp > k:
22792283
k = tmp
@@ -2283,11 +2287,15 @@ def to_object_array_tuples(rows: list):
22832287
try:
22842288
for i in range(n):
22852289
row = rows[i]
2290+
if checknull(row):
2291+
continue
22862292
for j in range(len(row)):
22872293
result[i, j] = row[j]
22882294
except Exception:
22892295
# upcast any subclasses to tuple
22902296
for i in range(n):
2297+
if checknull(rows[i]):
2298+
continue
22912299
row = tuple(rows[i])
22922300
for j in range(len(row)):
22932301
result[i, j] = row[j]

pandas/tests/test_strings.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,8 +236,8 @@ def test_api_per_method(self, box, dtype,
236236

237237
# TODO: get rid of these xfails
238238
if (method_name in ['partition', 'rpartition'] and box == Index
239-
and inferred_dtype != 'bytes'):
240-
pytest.xfail(reason='Method not nan-safe on Index; see GH 23558')
239+
and inferred_dtype == 'empty'):
240+
pytest.xfail(reason='Method cannot deal with empty Index')
241241
if (method_name == 'get_dummies' and box == Index
242242
and inferred_dtype == 'empty' and (dtype == object
243243
or values.size == 0)):

0 commit comments

Comments
 (0)