mirror of
https://github.com/wassname/catalyst.git
synced 2026-08-05 12:50:21 +08:00
PERF: Updated to sort_values for new pandas
This commit is contained in:
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user