diff --git a/zipline/lib/labelarray.py b/zipline/lib/labelarray.py index 03ca46f5..96a2a4fc 100644 --- a/zipline/lib/labelarray.py +++ b/zipline/lib/labelarray.py @@ -280,7 +280,9 @@ class LabelArray(ndarray): raise ValueError("Can't convert a 2D array to a categorical.") return pd.Categorical.from_codes( self.as_int_array(), - self.categories, + # We need to make a copy because pandas >= 0.17 fails if this + # buffer isn't writeable. + self.categories.copy(), ordered=False, name=name, )