MAINT: Make load_adjusted_array return a dict.

Rather than a list that's ordered the same as the received columns.
Most nontrivial loaders were constructing dicts internally and then
converting back to lists, only to have the engine convert **back again**
into a dict.  This cuts out the middleman, and prevents bugs due to
incorrect ordering of the output arrays.
This commit is contained in:
Scott Sanderson
2015-11-03 11:16:21 -05:00
parent f98349e24d
commit 8cd4f7d100
7 changed files with 23 additions and 28 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ class DataFrameLoaderTestCase(TestCase):
self.dates[dates_slice],
self.sids[sids_slice],
self.mask[dates_slice, sids_slice],
)
).values()
for idx, window in enumerate(adj_array.traverse(window_length=3)):
expected = baseline.values[dates_slice, sids_slice][idx:idx + 3]
@@ -35,6 +35,7 @@ from pandas import (
Timestamp,
)
from testfixtures import TempDirectory
from toolz.curried.operator import getitem
from zipline.lib.adjustment import Float64Multiply
from zipline.pipeline.loaders.synthetic import (
@@ -422,12 +423,13 @@ class USEquityPricingLoaderTestCase(TestCase):
adjustment_reader,
)
closes, volumes = pricing_loader.load_adjusted_array(
results = pricing_loader.load_adjusted_array(
columns,
dates=query_days,
assets=self.assets,
mask=ones((len(query_days), len(self.assets)), dtype=bool),
)
closes, volumes = map(getitem(results), columns)
expected_baseline_closes = self.bcolz_writer.expected_values_2d(
shifted_query_days,
@@ -500,12 +502,13 @@ class USEquityPricingLoaderTestCase(TestCase):
adjustment_reader,
)
highs, volumes = pricing_loader.load_adjusted_array(
results = pricing_loader.load_adjusted_array(
columns,
dates=query_days,
assets=Int64Index(arange(1, 7)),
mask=ones((len(query_days), 6), dtype=bool),
)
highs, volumes = map(getitem(results), columns)
expected_baseline_highs = self.bcolz_writer.expected_values_2d(
shifted_query_days,