Thank you very much for your replies. xarray is perfect though I'm not sure
what overhead I'm paying to get the following:
import numpy as np
import xarray as xr
data = xr.DataArray(np.random.randn(2, 3, 4), dims=("x", "y", "z"))
data.transpose('z', 'y', 'x').shape
data.transpose('y', 'z', 'x').s
On Tue, May 17, 2022 at 10:36 PM Joseph Fox-Rabinovitz <
jfoxrabinov...@gmail.com> wrote:
> You could easily write an extension to ndarray that maps axis names to
> indices and vice versa.
>
Indeed. There have been several over the years. The current most-maintained
one is xarray, near as I can t
You could easily write an extension to ndarray that maps axis names to
indices and vice versa.
Joe
On Tue, May 17, 2022, 21:32 Paul Korir wrote:
> Thanks for your replies.
>
> In retrospect, I realise that using the shape will not be helpful for a
> cubic array i.e. the permutations of (10, 10,
Thanks for your replies.
In retrospect, I realise that using the shape will not be helpful for a cubic
array i.e. the permutations of (10, 10, 10) are all (10, 10, 10)! However, the
problem remains. Let me try to explain.
Short version
The problem boils down to the meaning of axis indices as a
On Tue, 2022-05-17 at 12:16 +0200, Andras Deak wrote:
> On Mon, May 16, 2022, at 17:54, Paul Korir wrote:
> > Hellos,
> > I would like to propose
> > `numpy.ndarray.permute_shape()`
> > method to predictably permute the shape of an ndarray. In my
> > opinion,
> > the current alternatives (`swapax
On Mon, May 16, 2022, at 17:54, Paul Korir wrote:
> Hellos,
> I would like to propose `numpy.ndarray.permute_shape()`
> method to predictably permute the shape of an ndarray. In my opinion,
> the current alternatives (`swapaxes`, `transform`, `moveaxes` and
> friends) are counterintuitive and re