We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f090bd2 commit d40b54eCopy full SHA for d40b54e
1 file changed
patsy/util.py
@@ -583,6 +583,9 @@ def test_iterable():
583
def pandas_Categorical_from_codes(codes, categories):
584
assert have_pandas_categorical
585
586
+ # Old versions of pandas sometimes fail to coerce this to an array and
587
+ # just return it directly from .labels (?!).
588
+ codes = np.asarray(codes)
589
if hasattr(pandas.Categorical, "from_codes"):
590
return pandas.Categorical.from_codes(codes, categories)
591
else:
0 commit comments