Concatenate big numpy arrays
<p>Let's assume I have some NumPy arrays <code>a</code> and <code>b</code> where <code>a.shape</code> is <code>(N, 5000)</code> and <code>b.shape</code> is <code>(N, 2500)</code>. <code>N</code> is some number of samples which may vary based on my problem/algorithm - but its always the same for <code>a</code> and <code>b</code>.</p>

<p>Now I want another array <code>c</code> of shape <code>(N, 7500)</code> which holds <code>a</code>'s values in <code>[0:5000]</code> and <code>b</code>'s values in <code>[5000:7500]</code>.</p>

<p>Currently I am creating a zero-filled buffer array and slice the values into it:</p>

<pre><code># ...retrieving a
# ...retrieving b
c = zeros.((N, 7500)).astype(np.float32)

# insert values of a
c[:, 0:5000] = a

# insert values of b
c[:, 5000:7500] = b

# free up memory
del a, b
</code></pre>

<p>Is this a fast / efficient, (and therefore "pythonic" / "numpy'ish") way to do so? Or do <strong>better solutions in terms of space/memory consumption or computing time</strong> exist?</p>

<p><code>a</code> and <code>b</code> are loaded from somewhere else and preprocessed, so it is no option to somehow directly insert the data into a buffer <code>c</code> without creating <code>a</code> and <code>b</code>.</p>