Skip to content

Commit 4c81631

Browse files
committed
Fix categorical treatment with pandas 0.24
1 parent 8e2880c commit 4c81631

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

anndata/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def df_to_records_fixed_width(df):
201201
arrays = [index]
202202
for k in df.columns:
203203
names.append(k)
204-
if is_string_dtype(df[k]):
204+
if is_string_dtype(df[k]) and not is_categorical(df[k]):
205205
lengths = df[k].map(len)
206206
if is_categorical(lengths): lengths = lengths.cat.as_ordered()
207207
arrays.append(df[k].values.astype('S{}'.format(lengths.max())))

0 commit comments

Comments
 (0)