multidimensional-array

How to plot a multidimensional array in a 3D plot?

How to plot a multidimensional array in a 3D plot? Question: I have a multidimensional array (P x N x M) and I want to plot each N x M array in a 3D plot in such a way the P images are stacked along the z-axis. Do you know hw to do this in …

Total answers: 2

Looping using array name?

Looping using array name? Question: Im trying to loop over arrays with similar name, as such: a0=[] a1=[] a2=[] a3=[] a4=[] for k in range(len(mlac)): # mlac.shape (17280, 5) for I in range(len(mlac[0])): ‘a%i’%I.append(mlac[k][I]) # or : ‘a{}’.format(I).append(mlac[k][I]) But both are considered strings on the loop and cannot append. So for each iteration of ‘I’, …

Total answers: 3

Array Averages for "Hour of the Date in Year" in Python

Array Averages for "Hour of the Date in Year" in Python Question: I have two arrays: a 3D numpy array with shape (1, 87648, 100) and dtype float64 a 1D array with shape (87648,) and type pandas DatetimeIndex the values of the 3D array along the axis=1 correspond to the hourly sequence datetimes in the …

Total answers: 1

Finding indexes of elements in nested arrays

Finding indexes of elements in nested arrays Question: I have an array arr = [[[1, 2], [3, 4]], [5, 6]]. I am looking for a function f that returns me the indexes of the elements also in the nested array given only arr as input. For example, function(arr, 2) -> (0, 0, 1) Has some …

Total answers: 1

Python: 'IndexError: list assignment index out of range' from 2d-List

Python: 'IndexError: list assignment index out of range' from 2d-List Question: I got the error IndexError: list assignment index out of range by using the following code: expC = 0 imgC = 0 pictures = [[x for x in range(7)] for y in range(25)] for i in experimentNames: for pictureData in glob.iglob(‘{}/**/*.png’.format(i), recursive=True): img = …

Total answers: 1

How to convert 2d list into 3d?

How to convert 2d list into 3d? Question: I would to create a bracket after the lowest number. I have a short example below A = [[], [2,3], [2,5,7,10], [5,10], [15,20,21], [20,22], [20,27,36], [21,23], [32,35,40] ] I would like my results to be like this B = [ [[2,3], [2,5,7,10]], [[5,10]], [[15,20,21]], [[20,22], [20,27,36]], [[21,23]], …

Total answers: 2

copying 2D arrays in python

copying 2D arrays in python Question: I’m trying to copy a 2D array to another 2D array in python, then change the copy, without changing any other 2D arrays which are a copy of the original 2D array and they’re acting rather strangely. Upon consulting stackoverflow when I first needed to copy 2D arrays into …

Total answers: 2

How to match 2 two multi-dimensional list or array

How to match 2 two multi-dimensional list or array Question: I am having a bit of trouble finding a code to match 2 two multi-dimensional list or array over 21 rows. For example a1 to find a match in b1 and return the result. a1 = [ [ [91,15,25], [4,14,25] ], [ [91,115,215], [41,154,148] ] …

Total answers: 1

Reshape a 3d array to a 2d array with leading points

Reshape a 3d array to a 2d array with leading points Question: I want to reshape this array (Python) [[[0, 1, 2], [3, 4, 5], [6, 7, 8]], [[0, 1, 2], [3, 4, 5], [6, 7, 8]], [[0, 1, 2], [3, 4, 5], [6, 7, 8]]] To this: [ [0,0,0], [1,1,1], [2,2,2], [3,3,3], [4,4,4], [5,5,5], …

Total answers: 3