Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions python/pyarrow/tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ def test_types_picklable():
assert pickle.loads(data) == ty


def test_dictionary_type():
ty = pa.dictionary(pa.int32(), pa.array(['a', 'b', 'c']))
assert ty.index_type == pa.int32()
assert ty.dictionary.to_pylist() == ['a', 'b', 'c']


def test_fields_hashable():
in_dict = {}
fields = [pa.field('a', pa.int64()),
Expand Down
10 changes: 10 additions & 0 deletions python/pyarrow/types.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,16 @@ cdef class DictionaryType(DataType):
def __get__(self):
return self.dict_type.ordered()

property index_type:

def __get__(self):
return pyarrow_wrap_data_type(self.dict_type.index_type())

property dictionary:

def __get__(self):
return pyarrow_wrap_array(self.dict_type.dictionary())


cdef class ListType(DataType):

Expand Down