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,
)
| 166 | |
| 167 | |
| 168 | def 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 | |
| 197 | def bool_column_to_array( |
no test coverage detected