'data type not understood' a mistake in defining the list of column names
<p>I'm trying to assign column names using np.dtype</p>

<p>I have defined a list of names</p>

<pre><code>print fieldNameList

[u'A', u'B', u'C', u'D', u'E', u'F', u'G', u'H', u'I', u'J', u'K', u'L', u'M', u'N', u'S']
</code></pre>

<p>Then, array to string</p>

<pre><code>field_name = ', '.join(["('%s', '&lt;f8')" % w for w in fieldNameList])

print field_name

('A', '&lt;f8'), ('B', '&lt;f8'), ('C', '&lt;f8'), ('D', '&lt;f8'), ('E', '&lt;f8'), ('F', '&lt;f8'), ('G', '&lt;f8'), ('H', '&lt;f8'), ('I', '&lt;f8'), ('J', '&lt;f8'), ('K', '&lt;f8'), ('L', '&lt;f8'), ('M', '&lt;f8'), ('N', '&lt;f8'), ('S', '&lt;f8')
</code></pre>

<p>Then</p>

<pre><code>inarray = np.array(tup1,
                np.dtype([field_name]))
</code></pre>

<p>I get an error</p>

<pre><code>np.dtype([field_name]))
TypeError: data type not understood
</code></pre>

<p>When instead of a variable enter generated field_name get the desired result</p>

<pre><code>inarray = np.array(tup1,
            np.dtype([('A', '&lt;f8'), ('B', '&lt;f8'), ('C', '&lt;f8'), ('D', '&lt;f8'), ('E', '&lt;f8'), ('F', '&lt;f8'), ('G', '&lt;f8'), ('H', '&lt;f8'), ('I', '&lt;f8'), ('J', '&lt;f8'), ('K', '&lt;f8'), ('L', '&lt;f8'), ('M', '&lt;f8'), ('N', '&lt;f8'), ('S', '&lt;f8')]))
</code></pre>

<p>The number and names of columns depend on the input table. It defines user. Why can not the number and names of columns defined in the script.</p>

<p>Does anyone have an idea how to solve this problem?
Thanks in advance</p>