how to create empty numpy array to store different kinds of data
<p>I am trying to start with an empty numpy array. As the code progresses the first column should be filled with <code>datetime.datetime</code>, the second column should be filled with <code>str</code>, the third columns with <code>float</code>, and fourth column with <code>int</code>.</p>

<p>I tried the following:</p>

<pre><code>A = np.empty([10, 4])
A[0][0] = datetime.datetime(2016, 10, 1, 1, 0)
</code></pre>

<p>I get the error:</p>

<pre><code>TypeError: float() argument must be a string or a number
</code></pre>

<p>You can use <code>dtype=object</code>.</p>

<pre><code>A = np.empty([10, 4], dtype=object)
A[0][0] = datetime.datetime(2016, 10, 1, 1, 0)
</code></pre>

<p>It is also possible to use structured arrays, but then you have a fixed length for string objects. If you need arbitrary big objects you have to use <code>dtype=object</code>. But this often contradicts the purpose of arrays.</p>

python numpy