Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
local_csv hangups

Hi all, I've began playing around with Quantopian recently, mostly in the research section. So my issue is that I have a sample dataset I want to use with local_CSV but it won't the timestamp column as a valid date column. It is in the format of '7/23/2016 18:43'. Can I set it to accept this format of time? Also,

When I set it as the date column, it acccepts it readily enough, but then when I look at the output, I notice it has an extra row with 'Date' as a value in the date column. When I remove the date_column as index and referencing it as a date column, then it stores it as a string and adds a new column with unique keys.

2 responses

Hi Francisco, local_csv may not support parsing dates and times together. To get around this I would recommend that you try running local_csv without specifying a date column, and then parsing the datetimes after the fact using pd.to_datetime. You can then set the result as the index of the DataFrame.

Let me know if that works out. If you're still having trouble would you mind posting your notebook or a snippet so that I can take a look?

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Hey!
So I am having the same issue, also the fact that I want to use the "symbol_column" option, because I have two stocks in the csv, and I want them to be classified as different assets:

This is what I've tried:
stocks= local_csv('ibm_dell.csv', date_column='date')
stocks= local_csv('ibm_dell.csv', symbol_column= (['ibm', 'dell']), date_column='date') #In this one I get an error

and the outcome looks like this, with the extra cell.

                                                  symbol    signal  

date
2006-01-01 00:00:00+00:00 ibm 1
2006-02-01 00:00:00+00:00 ibm 0
2006-03-01 00:00:00+00:00 ibm 0
2006-04-01 00:00:00+00:00 ibm 0
2006-05-01 00:00:00+00:00 ibm 1
2006-06-01 00:00:00+00:00 ibm 1
2006-07-01 00:00:00+00:00 ibm 1
2006-08-01 00:00:00+00:00 ibm 1
2006-09-01 00:00:00+00:00 ibm 0
2006-10-01 00:00:00+00:00 ibm 1
2006-11-01 00:00:00+00:00 ibm 1
2006-12-01 00:00:00+00:00 ibm 5
2007-01-01 00:00:00+00:00 ibm 1
2007-02-01 00:00:00+00:00 ibm 0
2007-03-01 00:00:00+00:00 ibm 1
2007-04-01 00:00:00+00:00 ibm 0
2007-05-01 00:00:00+00:00 ibm 1
2006-01-01 00:00:00+00:00 dell 1
2006-02-01 00:00:00+00:00 dell 0
2006-03-01 00:00:00+00:00 dell 0
2006-04-01 00:00:00+00:00 dell 0
2006-05-01 00:00:00+00:00 dell 1
2006-06-01 00:00:00+00:00 dell 1
2006-07-01 00:00:00+00:00 dell 1
2006-08-01 00:00:00+00:00 dell 1
2006-09-01 00:00:00+00:00 dell 0
2006-10-01 00:00:00+00:00 dell 1
2006-11-01 00:00:00+00:00 dell 1
2006-12-01 00:00:00+00:00 dell 5
2007-01-01 00:00:00+00:00 dell 1
2007-02-01 00:00:00+00:00 dell 0
2007-03-01 00:00:00+00:00 dell 1
2007-04-01 00:00:00+00:00 dell 0
2007-05-01 00:00:00+00:00 dell 1

Thank you for your help.

Cheers!

Seb