Category "multidimensional-array"

Transpose multidimensional array and join values with commas

How to group by comma of every value as per same key? I need to re-orientate the array so that rows become columns and the new rows need to be joined together

Extracting multiple sets of rows/ columns from a 2D numpy array

I have a 2D numpy array from which I want to extract multiple sets of rows/ columns. # img is 2D array img = np.arange(25).reshape(5,5) array([[ 0, 1, 2, 3,

Using array_intersect on a multi-dimensional array

I have two arrays that both look like this: Array ( [0] => Array ( [name] => STRING [value] => STRING )

How to loop a tree array with unknown depth and get array blocks?

I found this solution to loop and print an unknown depth array: printAllValues($arr); function printAllValues($arr) { if(!is_array($arr)) {

PyTorch torch.max over multiple dimensions

Have tensor like :x.shape = [3, 2, 2]. import torch x = torch.tensor([ [[-0.3000, -0.2926],[-0.2705, -0.2632]], [[-0.1821, -0.1747],[-0.1526, -0.1453]

How to select top level columns in multi header pandas dataframe

I have a multi header dataframe and it looks like that: SPY ARKW Open Hig

PHP: set a (deep) array key from an array [closed]

is there a PHP function that would create a (deep) array key from an array ? It's quite difficult to explain, see that example: function myst

How to find or count the duplicate in multidimensional array in c# [closed]

I am creating a 2d (3 * 3) array in c# which has to count or find the duplicate value int[,] arr = new int[3, 3] { {1, 2, 6}, {4, 1, 5}

Can numpy.tensordot or ufunc replace this nested for loop?

Note: I know this is very similar to Use numpy.tensordot to replace a nested loop , only that the actual instance we are working on seemed different( I need qua

Perl: Multidimentional arrays and "experimental push" error

I'm a junior perl programmer and have very little experience with multidimentional arrays. I'm not even sure it is the proper data structure for this project. I

Sum column values from multiple arrays

I have an arrays with dynamic name. My array could be more than 3, depends and array variable should be unique $loopThrice = 3; $getSum = 0; $total = array();

Sort multidimensional array by column value within a column

I have an array in PHP and I need to sort by a nested array inside of the array... Here is my array: Array ( [0] => Array ( [project_

Sum array values of a column within each column of an array with 3 levels

I'm trying to use array_sum() on columns within columns of a multidimensional array. For eg: I have an array that looks like this: $array = [ [['value' =>

How to remove from a multidimensional array all duplicate elements including the original?

I am using php 7.1. I have seen that to eliminate the duplicate elements it is enough with this array_unique($array, SORT_REGULAR); I've also seen this work ar

Group rows by column and sum another column within groups [duplicate]

I have an array looking like: array(480) { [0]=> array(2) { ["tag_id"]=> string(4) "6291" ["az"]=> int(5) } [

Two 2D array's of coordinates, finding if any of the coordinates from the different arrays are within a set distance of one another (python)

I have been trying to figure out how to make it so there is two 2D arrays, each containing a number of arrays that have x and y coordinates for set objects of t

Deleting a column from a multidimensional array in javascript

I have a 2D array: var array = [["a", "b", "c"],["a", "b", "c"],["a", "b", "c"]] I want to delete an entire column of this array (i.e. delete every third ele

Search for array row with specific column value and return another value from qualifying row

I have a multidimensional array that I am trying to search for a specific value (url) and then retrieve an another value in the same row (value). I also need to

2d array index out of range exception

As soon as i enter the while loop the program throws Index out of range exception, without getting rows and columns value. getint is a method to get user input

Insert database rows from columns of data from associative array of indexed arrays

I have an array called $works which looks like this: [ 'type' => [1, 5], 'description' => [2, 6], 'hours' => [3, 7], 'amount' => [4,