title: Converting a GenericCSVData object to a backtrader datafeed
body: <p>How can I convert a <a href="https://www.backtrader.com/blog/posts/2015-08-04-generic-csv-datafeed/generic-csv-datafeed.html" rel="nofollow noreferrer">backtrader csv reader</a> to a <a href="https://www.backtrader.com/docu/pandas-datafeed/pandas-datafeed.html" rel="nofollow noreferrer">backtrader datafeed</a>? I tried:</p>
  
  <p><strong>Attempt 1: (replace datafeed with GenericCSV)</strong> </p>
  
  <pre><code>all_data=bt.feeds.GenericCSVData(
    #my csv params here
  )
  
  for s, df in all_data.items(): #THIS LINE READS IN CSV AND ERRORS
      #do stuff
  </code></pre>
  
  <blockquote>
    <p>'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'items'</p>
  </blockquote>
  
  <p><strong>Attempt 2: (convert GenericCSV to Datafeed)</strong> </p>
  
  <pre><code>all_data=bt.feeds.GenericCSVData(
    #my csv params here
  )
  all_datafeed = bt.feeds.PandasData(dataname=all_data) 
  </code></pre>
  
  <blockquote>
    <p>ERROR: 'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'columns'</p>
  </blockquote>
  
  <p><strong>Attempt 3: (Read in csv and convert to datafeed)</strong></p>
  
  <pre><code>df=pd.read_csv('/home/abc/EUR_USD.csv',header=0,parse_dates=True)
  all_datafeed = bt.feeds.PandasData(dataname=df)
  for df in all_datafeed.items():
      print(df)
  </code></pre>
  
  <blockquote>
    <p>'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'items'</p>
  </blockquote>
  
  <p>Excerpt from csv:</p>
  
  <pre><code>time,oask,hask,lask,cask,obid,hbid,lbid,cbid,volume
  2002-05-06 20:00:00 UTC,0.9184,0.9184,0.9181,0.9184,0.9181,0.9181,0.9181,0.9181,1
  2002-05-07 20:00:00 UTC,0.9155,0.9155,0.9152,0.9155,0.9152,0.9152,0.9152,0.9152,1
  2002-05-08 20:00:00 UTC,0.9045,0.9045,0.9042,0.9045,0.9042,0.9042,0.9042,0.9042,1
  </code></pre>