Skip to content

Commit 03290c6

Browse files
committed
wip
1 parent b6ef170 commit 03290c6

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

pandas/core/interchange/column.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -202,14 +202,7 @@ def describe_null(self):
202202
column_null_dtype = ColumnNullType.USE_BITMASK
203203
null_value = 0
204204
if ~self._col.isna().any():
205-
try:
206-
null, value = _NULL_DESCRIPTION[kind]
207-
except KeyError as err:
208-
raise NotImplementedError(
209-
f"Data type {kind} not yet supported"
210-
) from err
211-
212-
return null, value
205+
return column_null_dtype, None
213206
return column_null_dtype, null_value
214207
try:
215208
null, value = _NULL_DESCRIPTION[kind]

pandas/core/interchange/from_dataframe.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,12 @@ def string_column_to_ndarray(col: Column) -> tuple[np.ndarray, Any]:
300300
if null_kind in (ColumnNullType.USE_BITMASK, ColumnNullType.USE_BYTEMASK):
301301
assert buffers["validity"], "Validity buffers cannot be empty for masks"
302302
valid_buff, valid_dtype = buffers["validity"]
303-
null_pos = buffer_to_ndarray(
304-
valid_buff, valid_dtype, offset=col.offset, length=col.size()
305-
)
306-
if sentinel_val == 0:
307-
null_pos = ~null_pos
303+
if valid_buff is not None:
304+
null_pos = buffer_to_ndarray(
305+
valid_buff, valid_dtype, offset=col.offset, length=col.size()
306+
)
307+
if sentinel_val == 0:
308+
null_pos = ~null_pos
308309

309310
# Assemble the strings from the code units
310311
str_list: list[None | float | str] = [None] * col.size()
@@ -527,11 +528,12 @@ def set_nulls(
527528
elif null_kind in (ColumnNullType.USE_BITMASK, ColumnNullType.USE_BYTEMASK):
528529
assert validity, "Expected to have a validity buffer for the mask"
529530
valid_buff, valid_dtype = validity
530-
null_pos = buffer_to_ndarray(
531-
valid_buff, valid_dtype, offset=col.offset, length=col.size()
532-
)
533-
if sentinel_val == 0:
534-
null_pos = ~null_pos
531+
if valid_buff is not None:
532+
null_pos = buffer_to_ndarray(
533+
valid_buff, valid_dtype, offset=col.offset, length=col.size()
534+
)
535+
if sentinel_val == 0:
536+
null_pos = ~null_pos
535537
elif null_kind in (ColumnNullType.NON_NULLABLE, ColumnNullType.USE_NAN):
536538
pass
537539
else:

0 commit comments

Comments
 (0)