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

Method dtype

python/pyarrow/interchange/column.py:265–294  ·  view source on GitHub ↗

Dtype description as a tuple ``(kind, bit-width, format string, endianness)``. Bit-width : the number of bits as an integer Format string : data type description format string in Apache Arrow C Data Interface format. Endianness : curr

(self)

Source from the content-addressed store, hash-verified

263
264 @property
265 def dtype(self) -> Tuple[DtypeKind, int, str, str]:
266 """
267 Dtype description as a tuple ``(kind, bit-width, format string,
268 endianness)``.
269
270 Bit-width : the number of bits as an integer
271 Format string : data type description format string in Apache Arrow C
272 Data Interface format.
273 Endianness : current only native endianness (``=``) is supported
274
275 Notes:
276 - Kind specifiers are aligned with DLPack where possible (hence the
277 jump to 20, leave enough room for future extension)
278 - Masks must be specified as boolean with either bit width 1 (for
279 bit masks) or 8 (for byte masks).
280 - Dtype width in bits was preferred over bytes
281 - Endianness isn't too useful, but included now in case in the
282 future we need to support non-native endianness
283 - Went with Apache Arrow format strings over NumPy format strings
284 because they're more complete from a dataframe perspective
285 - Format strings are mostly useful for datetime specification, and
286 for categoricals.
287 - For categoricals, the format string describes the type of the
288 categorical in the data buffer. In case of a separate encoding of
289 the categorical (e.g. an integer to string mapping), this can
290 be derived from ``self.describe_categorical``.
291 - Data types not included: complex, Arrow-style null, binary,
292 decimal, and nested (list, struct, map, union) dtypes.
293 """
294 return self._dtype
295
296 def _dtype_from_arrowdtype(
297 self, dtype: pa.DataType, bit_width: int

Callers 15

test_dlpackFunction · 0.80
test_from_numpy_dtypeFunction · 0.80
test_asarrayFunction · 0.80
test_from_numpyMethod · 0.80

Calls

no outgoing calls

Tested by 15

test_dlpackFunction · 0.64
test_from_numpy_dtypeFunction · 0.64
test_asarrayFunction · 0.64
test_from_numpyMethod · 0.64
test_from_numpy_largeMethod · 0.64