Numpy array trims string values
<p>Here is the code I am trying to execute</p>

<pre><code>matrix = []
sample = [10,10,'mike','']
for i in range(10):
    r = [sample] * 3
    matrix.append(r)

matrix = np.array(matrix)
matrix[1][1] = [123,123,'james', 'sdfsdfsdf werwerwer sdfsdfsd werwerwer sdfsdfsdf']
print matrix[1][1]
</code></pre>

<p>and here is what I am getting</p>

<pre><code>['123' '123' 'james' 'sdfsdfsdf w']
</code></pre>

<p>so basically the text is trimmed for some reason. Has anyone seen it before?</p>

<p>I found the problem.</p>

<p>conversion from native Python array to Numpy should take place as the last step.</p>

<pre><code>matrix[1][1] = [123,123,'james', 'sdfsdfsdf werwerwer sdfsdfsd werwerwer sdfsdfsdf']
matrix = np.array(matrix)
</code></pre>

<p>Now works fine.</p>

python numpy