Store array of string values in column in pandas?
<p>I have a pandas dataframe. I have a column that could potentially have null values or an array of string values in it. But I'm having trouble working out how to store values in this column. </p>

<p>This is my code now:</p>

<pre><code>df_completed = df[df.completed]
df['links'] = None
for i, row in df_completed.iterrows():
    results = get_links(row['nct_id'])
    if results:
        df[df.nct_id == row['nct_id']].links = results
        print df[df.nct_id == row['nct_id']].links
</code></pre>

<p>But this has two problems:</p>

<ul>
<li>When <code>results</code> is an array of length 1, the printed output is None, rather than the array, so I think I must be saving the value wrong</li>
<li>When <code>results</code> is a longer array, the line where I save the value produces an error: <code>ValueError: Length of values does not match length of index</code></li>
</ul>

<p>What am I doing wrong?</p>