Adding a column of list to a dataframe python
<p>I have a data frame in pandas as below:</p>

<pre><code>    Type      Rand      Arrival
     0         0.3        4
     2         0.64       3
     1         0.98       12
</code></pre>

<p>Now, I want to add a new column to it that is list in each row:</p>

<pre><code>    Type      Rand      Arrival         Park
     0         0.3        4          [5,10,15,20]
     2         0.64       3          [4,9,14,19]
     1         0.98       12         [6,11,16,21]
</code></pre>

<p>I want to do that based on the 'Rand' column by comparing it to some values using the following commands:</p>

<pre><code>   df.loc[ (df.Rand &lt;= 0.4) , 'Park' ] = [5,10,15,20]
   df.loc[ (df.Rand &gt; 0.4) &amp; (df.Rand &lt;= 0.8) , 'Park' ] = [4,9,14,19]
   df.loc[ (df.Rand &gt; 0.8) , 'Park' ] = [6,11,16,21]
</code></pre>

<p>But I am getting the following error:</p>

<pre><code>  Must have equal len keys and value when setting with an iterable.
</code></pre>

<p>Could you please tell me hot to overcome this issue?</p>