title: python pandas: list of integers as individual values of DataFrame
body: <p><strong>Question:</strong>
  How to 'pd.read_csv' so that the values in a given column are of <strong>type list</strong> (a list <strong>in each row of a column</strong>)?</p>
  
  <p>When creating a DataFrame (from a dict, see below), individual values are of type list. The problem: After writing the DataFrame to a file and reading from the file back to a DataFrame, I get a string instead of a list.</p>
  
  creating the DataFrame
  
  <pre><code>import pandas as pd
  dict2df = {"euNOG": ["ENOG410IF52", "KOG2956", "KOG1997"], 
             "neg": [[58], [1332, 753, 716, 782], [187]], 
             "pos": [[96], [659, 661, 705, 1228], [1414]]}
  df = pd.DataFrame(dict2df)
  </code></pre>
  
  <h1>value is a list</h1>
  
  <pre><code>type(df.loc[0, 'neg']) == list # --&gt; True
  type(df.loc[0, 'neg']) == str # --&gt; False
  df.loc[1, 'neg'][-1] == 782 # --&gt; True
  </code></pre>
  
  write to file
  
  <pre><code>df.to_csv('DataFrame.txt', sep='\t', header=True, index=False)
  </code></pre>
  
  read from file
  
  <pre><code>df = pd.read_csv('DataFrame.txt', sep='\t')
  </code></pre>
  
  <h1>value is a string not a list</h1>
  
  <pre><code>type(df.loc[0, 'neg']) == list # --&gt; False
  type(df.loc[0, 'neg']) == str # --&gt; True
  df.loc[1, 'neg'][-1] == 782 # --&gt; False
  </code></pre>
  
  <p>Of course, it's possible to convert between the two data types, but it's computationally expensive and needs extra work (see below)</p>
  
  <pre><code>def convert_StringList2ListOfInt(string2convert):
      return [int(ele) for ele in string2convert[1:-1].split(',')]
  
  def DataFrame_StringOfInts2ListOfInts(df, cols2convert_list):
      for column in cols2convert_list:
          column_temp = column + "_temp"
          df[column_temp] = df[column].apply(convert_StringList2ListOfInt, 1)
          df[column] = df[column_temp]
          df = df.drop(column_temp, axis=1)
      return df
  df = DataFrame_StringOfInts2ListOfInts(df, ['neg', 'pos'])
  </code></pre>
  
  <p><strong>What would be a better (more pythonic) solution?</strong> It would be very convenient to iterate over the Integers in the list without having to convert them back and forth.
  Thank you for your support!!</p>