Skip to content

Commit b6ef170

Browse files
committed
wip
1 parent 057acd5 commit b6ef170

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

pandas/core/interchange/column.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ def describe_null(self):
205205
try:
206206
null, value = _NULL_DESCRIPTION[kind]
207207
except KeyError as err:
208-
raise NotImplementedError(f"Data type {kind} not yet supported") from err
208+
raise NotImplementedError(
209+
f"Data type {kind} not yet supported"
210+
) from err
209211

210212
return null, value
211213
return column_null_dtype, null_value
@@ -296,16 +298,6 @@ def _get_data_buffer(
296298
"""
297299
Return the buffer containing the data and the buffer's associated dtype.
298300
"""
299-
if isinstance(self._col.dtype, ArrowDtype):
300-
arr = self._col.array
301-
buffer = PandasPyarrowBackedBuffer(arr._pa_array.chunks[0].buffers()[1])
302-
dtype = (
303-
DtypeKind.BOOL,
304-
8,
305-
ArrowCTypes.BOOL,
306-
Endianness.NATIVE,
307-
) # note: currently only support native endianness
308-
return buffer, dtype
309301
if self.dtype[0] == DtypeKind.DATETIME:
310302
# self.dtype[2] is an ArrowCTypes.TIMESTAMP where the tz will make
311303
# it longer than 4 characters
@@ -326,13 +318,17 @@ def _get_data_buffer(
326318
DtypeKind.FLOAT,
327319
DtypeKind.BOOL,
328320
):
321+
dtype = self.dtype
329322
arr = self._col.array
323+
if isinstance(self._col.dtype, ArrowDtype):
324+
arr = self._col.array
325+
buffer = PandasPyarrowBackedBuffer(arr._pa_array.chunks[0].buffers()[1])
326+
return buffer, dtype
330327
if isinstance(self._col.dtype, BaseMaskedDtype):
331328
np_arr = arr._data # type: ignore[attr-defined]
332329
else:
333330
np_arr = arr._ndarray # type: ignore[attr-defined]
334331
buffer = PandasBuffer(np_arr, allow_copy=self._allow_copy)
335-
dtype = self.dtype
336332
elif self.dtype[0] == DtypeKind.CATEGORICAL:
337333
codes = self._col.values._codes
338334
buffer = PandasBuffer(codes, allow_copy=self._allow_copy)

0 commit comments

Comments
 (0)