PERF: Updated to sort_values for new pandas

This commit is contained in:
Richard Frank
2016-02-11 18:46:43 -05:00
parent 069fe5ccda
commit 1075e0573e
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -70,6 +70,7 @@ from pandas.tseries.tools import normalize_date
import zipline.finance.risk as risk
from . period import PerformancePeriod
from zipline.utils.pandas_utils import sort_values
from zipline.utils.serialization_utils import (
VERSION_LABEL
)
@@ -200,9 +201,9 @@ class PerformanceTracker(object):
)
self._dividend_count += len(new_dividends)
self.dividend_frame = pd.concat(
self.dividend_frame = sort_values(pd.concat(
[self.dividend_frame, new_dividends]
).sort(['pay_date', 'ex_date']).set_index('id', drop=False)
), ['pay_date', 'ex_date']).set_index('id', drop=False)
def initialize_dividends_from_other(self, other):
"""
+2 -1
View File
@@ -15,6 +15,7 @@ from pandas import (
)
from zipline.lib.adjusted_array import AdjustedArray
from zipline.lib.adjustment import make_adjustment_from_labels
from zipline.utils.pandas_utils import sort_values
from .base import PipelineLoader
ADJUSTMENT_COLUMNS = Index([
@@ -71,7 +72,7 @@ class DataFrameLoader(PipelineLoader):
else:
# Ensure that columns are in the correct order.
adjustments = adjustments.reindex_axis(ADJUSTMENT_COLUMNS, axis=1)
adjustments.sort(['apply_date', 'sid'], inplace=True)
sort_values(adjustments, ['apply_date', 'sid'], inplace=True)
self.adjustments = adjustments
self.adjustment_apply_dates = DatetimeIndex(adjustments.apply_date)