Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitry Chigarev <zeeron209@gmail.com>
  • Loading branch information
vnlitvinov and dchigarev committed Aug 10, 2022
1 parent c9ffbf2 commit a9fd84a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ class ColumnBuffers(TypedDict): # noqa: GL08
class CategoricalDescription(TypedDict): # noqa: GL08
# whether the ordering of dictionary indices is semantically meaningful
is_ordered: bool
# whether a dictionary-style mapping of categorical values to other objects exists
# whether a column-style mapping of categorical values to other objects exists
is_dictionary: bool
# Python-level only (e.g. ``{int: str}``).
# None if not a column-style categorical.
categories: Optional["ProtocolColumn"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def describe_categorical(self) -> CategoricalDescription:
)

pandas_series = self._col.to_pandas().squeeze(axis=1)
cat_frame = Series(pandas_series.cat.categories)._query_compiler._modin_frame
cat_frame = self._col.from_pandas(pandas_series.cat.categories)
return {
"is_ordered": pandas_series.cat.ordered,
"is_dictionary": True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,9 @@ def describe_categorical(self) -> CategoricalDescription:
col = col.combine_chunks()

col = col.chunks[0]
cat_frame = Series(col.dictionary.tolist())._query_compiler._modin_frame
cat_frame = OmnisciOnNativeDataframe.from_arrow(
pyarrow.Table.from_pydict({self._col.column_names[0]: col.dictionary})
)
from .dataframe import OmnisciProtocolDataframe

return {
Expand Down

0 comments on commit a9fd84a

Please sign in to comment.