Skip to content

Commit

Permalink
Fix categorical treatment with pandas 0.24
Browse files Browse the repository at this point in the history
  • Loading branch information
flying-sheep committed Jan 29, 2019
1 parent 8e2880c commit 4c81631
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion anndata/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def df_to_records_fixed_width(df):
arrays = [index]
for k in df.columns:
names.append(k)
if is_string_dtype(df[k]):
if is_string_dtype(df[k]) and not is_categorical(df[k]):
lengths = df[k].map(len)
if is_categorical(lengths): lengths = lengths.cat.as_ordered()
arrays.append(df[k].values.astype('S{}'.format(lengths.max())))
Expand Down

0 comments on commit 4c81631

Please sign in to comment.