MAINT: Update fetcher for pandas 0.18.

- Remove support for usecols=[].
- Use sort_values instead of sort().
- Use errors='coerce' instead of coerce=True.
This commit is contained in:
Scott Sanderson
2016-09-20 16:24:55 -04:00
parent 930f32f6a1
commit f494003c18
2 changed files with 4 additions and 26 deletions
+2 -24
View File
@@ -297,7 +297,6 @@ def handle_data(context, data):
@parameterized.expand([("unspecified", ""),
("none", "usecols=None"),
("empty", "usecols=[]"),
("without date", "usecols=['Value']"),
("with date", "usecols=('Value', 'Date')")])
def test_usecols(self, testname, usecols):
@@ -325,30 +324,9 @@ def initialize(context):
context.stocks = [sid(3766), sid(25317)]
def handle_data(context, data):
if {should_have_data}:
try:
data.current("urban", "cpi")
except (KeyError, ValueError):
assert False
else:
try:
data.current("urban", "cpi")
except (KeyError, ValueError):
assert True
data.current("urban", "cpi")
"""
results = self.run_algo(
code.format(
usecols=usecols,
should_have_data=testname in [
'none',
'unspecified',
'without date',
'with date',
],
)
)
results = self.run_algo(code.format(usecols=usecols))
# 251 trading days in 2006
self.assertEqual(len(results), 251)
+2 -2
View File
@@ -224,7 +224,7 @@ class PandasCSV(with_metaclass(ABCMeta, object)):
date_str_series.values,
format=format_str,
utc=True,
coerce=True,
errors='coerce',
)
else:
parsed = pd.to_datetime(
@@ -301,7 +301,7 @@ class PandasCSV(with_metaclass(ABCMeta, object)):
df['sid'] = self.symbol
elif self.finder:
df.sort(self.symbol_column)
df.sort_values(by=self.symbol_column, inplace=True)
# Pop the 'sid' column off of the DataFrame, just in case the user
# has assigned it, and throw a warning