Hi
So I'm struggling with the basics of reading a csv into a reseach notebook. The CSV has headers Date, Data1. When I try the following I only get ‘D’. How to get the csvreader to read the whole first line? or better yet to get all the data into a dataframe, then I can start working with the dataframe and match it to other data.
from io import StringIO
import csv
import pandas as pd
qb = QuantBook()
csvfile = qb.Download('https://www.dropbox.com/s/7j45m55pjy1qfrm/test_drop.csv?dl=1')
#df = pd.DataFrame(csv.reader(csvfile))
csvreader = csv.reader(csvfile)
header = []
header = next(csvreader)
header
Yuri Lopukhov
You can do it like this:
Newoptionz
Thanks Yuri, final code is
Newoptionz
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!