Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #77144 > unrolled thread
| Started by | Maximilian Albert <maximilian.albert@gmail.com> |
|---|---|
| First post | 2014-08-27 17:18 +0100 |
| Last post | 2014-08-27 17:18 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [SciPy-User] Convert 3d NumPy array into 2d Maximilian Albert <maximilian.albert@gmail.com> - 2014-08-27 17:18 +0100
| From | Maximilian Albert <maximilian.albert@gmail.com> |
|---|---|
| Date | 2014-08-27 17:18 +0100 |
| Subject | Re: [SciPy-User] Convert 3d NumPy array into 2d |
| Message-ID | <mailman.13514.1409156305.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
[source] <http://github.com/numpy/numpy/blob/v1.8.1/numpy/core/fromnumeric.py#L1072> <http://docs.scipy.org/doc/numpy/reference/generated/numpy.squeeze.html#numpy.squeeze> 2014-08-27 16:08 GMT+01:00 phinn stuart <dphinnstuart@gmail.com>: > Hi everyone, how can I convert (1L, 480L, 1440L) shaped numpy array into > (480L, 1440L)? > If 'a' is your array then 'a.squeeze()' or 'a.squeeze(axis=0)' will do the job (see the docs at [1]). You can also say a.reshape(480, 1440) but obviously this is only useful if you know the exact dimensions of your array. Cheers, Max [1] http://docs.scipy.org/doc/numpy/reference/generated/numpy.squeeze.html
Back to top | Article view | comp.lang.python
csiph-web