title: Reading the csv and formatting it to a dictionary with Pandas Python
body: <p>I ma trying to convert the Code below to <code>pandas</code>. How would I be able to do convert to have both <code>reader</code> functions equivalent so that <code>account_strats</code> function works. The <code>pandas</code> implementation is faulty giving error defined below, how would I be able to fix it and convert it into <code>pandas</code> type.</p>
  <p>CSV:</p>
  <pre><code>Name,AccountName,Type
  XXX,Account1,RSIStrategy
  XYB,Account1,MACDStrategy2.0
  XBR,Account1,STDandRegressionStrategy
  </code></pre>
  <p>Code that works:</p>
  <pre><code>import csv 
  
  for account in range(2):
      file = open(&quot;SavedStrats.csv&quot;)
      reader = csv.DictReader(file)
      account_strats = [strat for strat in reader if strat[&quot;AccountName&quot;] == account]
      file.close()
  </code></pre>
  <p>Pandas Implementation(Code faulty):</p>
  <pre><code>import pandas as pd
  
  for account in range(2):
      reader= pd.read_csv(&quot;SavedStrats.csv&quot;).to_dict('dict')
      account_strats = [strat for strat in reader if strat[&quot;AccountName&quot;] == account]
  </code></pre>
  <p>Error:</p>
  <pre><code>TypeError: string indices must be integers
  </code></pre>