pyarrow.dictionary#
- pyarrow.dictionary(index_type,value_type,boolordered=False)→DictionaryType#
Dictionary (categorical, or simply encoded) type.
- Parameters:
- Returns:
- type
DictionaryType
- type
Examples
Create an instance of dictionary type:
>>>importpyarrowaspa>>>pa.dictionary(pa.int64(),pa.utf8())DictionaryType(dictionary<values=string, indices=int64, ordered=0>)
Use dictionary type to create an array:
>>>pa.array(["a","b",None,"d"],pa.dictionary(pa.int64(),pa.utf8()))<pyarrow.lib.DictionaryArray object at ...>...-- dictionary: [ "a", "b", "d" ]-- indices: [ 0, 1, null, 2 ]
On this page

