Skip to content

Commit

Permalink
Remove conversion of categorical dtype columns
Browse files Browse the repository at this point in the history
  • Loading branch information
binste committed Jul 31, 2023
1 parent 371255a commit 5828b8f
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions altair/utils/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,7 @@ def to_list_if_array(val):

for col_name, dtype in df.dtypes.items():
dtype_name = str(dtype)
if dtype_name == "category":
# Work around bug in to_json for categorical types in older versions of pandas
# https://github.com/pydata/pandas/issues/10778
# https://github.com/altair-viz/altair/pull/2170
col = df[col_name].astype(object)
df[col_name] = col.where(col.notnull(), None)
elif dtype_name == "string":
if dtype_name == "string":
# dedicated string datatype (since 1.0)
# https://pandas.pydata.org/pandas-docs/version/1.0.0/whatsnew/v1.0.0.html#dedicated-string-data-type
col = df[col_name].astype(object)
Expand Down

0 comments on commit 5828b8f

Please sign in to comment.