Skip to content

Commit d40b54e

Browse files
committed
Fix weird test failure on pandas 0.14
1 parent f090bd2 commit d40b54e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

patsy/util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,9 @@ def test_iterable():
583583
def pandas_Categorical_from_codes(codes, categories):
584584
assert have_pandas_categorical
585585

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)
586589
if hasattr(pandas.Categorical, "from_codes"):
587590
return pandas.Categorical.from_codes(codes, categories)
588591
else:

0 commit comments

Comments
 (0)