Can a pandas DataFrame hold non-scalar values?
<p>I'd like a DataFrame to store non-primitive types, in particular I would need a column that can have lists as its items.</p>

<pre><code>pd.DataFrame( [["foo","bar"],["rab","oof"]], ["my-column-of-lists"] )
</code></pre>

<p>should result in a DataFrame with one column (<code>my-column-of-lists</code>) and 2 rows (<code>["foo","bar"]</code> and <code>["rab","oof"]</code>).</p>

<p>Is that possible?</p>

<p>You can use <code>dict</code>:</p>

<pre><code>df = pd.DataFrame({'my-column-of-lists': [["foo","bar"],["rab","oof"]]})
print (df)
  my-column-of-lists
0         [foo, bar]
1         [rab, oof]
</code></pre>

<p>Or pass <code>Series</code>:</p>

<pre><code>df = pd.DataFrame(pd.Series([["foo","bar"],["rab","oof"]], name='my-column-of-lists'))
print (df)
  my-column-of-lists
0         [foo, bar]
1         [rab, oof]
</code></pre>

python list pandas dataframe