MCPcopy Create free account
hub / github.com/apache/arrow / column_to_array

Function column_to_array

python/pyarrow/interchange/from_dataframe.py:168–194  ·  view source on GitHub ↗

Convert a column holding one of the primitive dtypes to a PyArrow array. A primitive type is one of: int, uint, float, bool (1 bit). Parameters ---------- col : ColumnObject allow_copy : bool, default: True Whether to allow copying the memory to perform the conversi

(
    col: ColumnObject,
    allow_copy: bool = True,
)

Source from the content-addressed store, hash-verified

166
167
168def column_to_array(
169 col: ColumnObject,
170 allow_copy: bool = True,
171) -> pa.Array:
172 """
173 Convert a column holding one of the primitive dtypes to a PyArrow array.
174 A primitive type is one of: int, uint, float, bool (1 bit).
175
176 Parameters
177 ----------
178 col : ColumnObject
179 allow_copy : bool, default: True
180 Whether to allow copying the memory to perform the conversion
181 (if false then zero-copy approach is requested).
182
183 Returns
184 -------
185 pa.Array
186 """
187 buffers = col.get_buffers()
188 data_type = col.dtype
189 data = buffers_to_array(buffers, data_type,
190 col.size(),
191 col.describe_null,
192 col.offset,
193 allow_copy)
194 return data
195
196
197def bool_column_to_array(

Callers 2

Calls 3

buffers_to_arrayFunction · 0.85
get_buffersMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected