From bd49647ce02a7aaad6ae67ab01958b7d83befe2d Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Wed, 4 May 2016 19:38:28 -0400 Subject: [PATCH] BUG: Fix failure on pandas >= 0.17. --- zipline/lib/labelarray.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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, )