Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
fetch_csv multiple columns - Always picking the last one

Hello folks,

I am using fetch_csv to pull in a custom trigger file that I am massaging on another server.

Data is:


Report_Date_as_MM_DD_YYYY,Value,M_Money_Positions_Long_ALL,M_Money_Positions_Short_ALL  
2015-02-09 00:00:00,0.971660184826,1.01063518308  
2015-02-02 00:00:00,1.05036958713,1.17507058074  
2015-01-26 00:00:00,0.996146637139,0.97929879499  
2015-01-19 00:00:00,1.13220621458,1.2342616715

The code I am using for fetcher is -

fetch_csv('http://my.host/use.csv',  
              date_column='Report_Date_as_MM_DD_YYYY',  
              symbol='cot',  
              usecols=['M_Money_Positions_Long_ALL'],  
              date_format='%m/%d/%Y')  

I am pulling the data into a variable using -

change_long = data['cot']['M_Money_Positions_Long_ALL']  

No matter what I try, it is always using the last column in the csv as its value. Here is a debug -

>  
data['cot']  
 data['cot']: SIDData  
M_Money_Positions_Long_ALL: 0.97929879499  
datetime: 2015-01-26 00:00:00+00:00  
dt: 2015-01-26 00:00:00+00:00  
get: <instancemethod>  
mavg: <instancemethod>  
returns: <instancemethod>  
sid: cot  
source_id: PandasRequestsCSV  
stddev: <instancemethod>  
type: 9  
vwap: <instancemethod>  

As you can see, 0.97929879499 is the wrong value for _Long. It is in the _Short column, but it seems to ignore anything but the last column in the csv.

Any ideas? I've been stuck on this for days.

Thanks.

1 response

Fixed.

There was a type-o and I had been up too long coding :)

Report_Date_as_MM_DD_YYYY,Value,M_Money_Positions_Long_ALL,M_Money_Positions_Short_ALL
Had an extra field (Value)