Category "arrays"

How to construct a ndarray from a numpy array? python

I can't seem to convert it into an ndarray in numpy, i've read http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.html but it didn't show me how

How to resize multidimensional (2D) array in C#?

I tried the following but it just returns a screwed up array. T[,] ResizeArray<T>(T[,] original, int rows, int cols) { var newArray = new

Extract subarray between certain value in Python

I have a list of values that are the result of merging many files. I need to pad some of the values. I know that each sub-section begins with the value -1. I am

Converting array to string and then back in PHP

I created a array using PHP $userarray = array('UserName'=>$username,'UserId'=>$userId,'UserPicURL'=>$userPicURL); How can I convert this array into

Is it possible to map only a portion of an array? (Array.map())

I am building a project using React.js as a front-end framework. On one particular page I am displaying a full data set to the user. I have an Array which conta

PHP drop down list using array's and foreach (else and for) code

I'm taking a course called "Dynamic Web Development with PHP" and after getting an F for an exercise, I wish if you could help me with the following. I have a p

Javascript - Remove duplicate ID from array of objects

Take the following two arrays: const array1 = [ { props: { type : 'text', id : 'item1', name : 'item1', value : '@item1@', },

How to replace item in array?

Each item of this array is some number: var items = Array(523,3452,334,31, ...5346); How to replace some item with a new one? For example, we want to replace 3

Converting an int[] to byte[] in C#

I know how to do this the long way: by creating a byte array of the necessary size and using a for-loop to cast every element from the int array. I was wonde

Create a new line whenever an array value reaches more than 10 characters

Here is my code, but it isn't dynamic. What I need is it will automatically create new line if array value is greater than 10. <?php $limit = 10; $newline =

array_map triple dimensional array [duplicate]

How do I run a array_map on a triple dimensional array? Where I want to "clear" the innermost array? It looks like this: Array ( [1] =&g

How to filter related models (hasMany relation) using where in LoopBack 3

Customer hasMany relationship with jobs Filtering by the top-level property works as shown below Customer.find({ include: ["jobs"],where :{username:"mel"} },

PHP array_filter with arguments

I have the following code: function lower_than_10($i) { return ($i < 10); } that I can use to filter an array like this: $arr = array(7, 8, 9, 10, 11

Check if string contains a value in array [duplicate]

I am trying to detect whether a string contains at least one URL that is stored in an array. Here is my array: $owned_urls = array('website1

Apply a function to three parallel array of arrays

I have three arrays of arrays like this: catLabels = [catA, catB, catC] binaryLabels = [binA, binB, binC] trueLabels = [] trueLabels.extend(repeat(y_true_cat

What is the most efficient way to concatenate N arrays?

What is the most efficient way to concatenate N arrays of objects in JavaScript? The arrays are mutable, and the result can be stored in one of the input array

Can numpy bincount work with 2D arrays?

I am seeing behaviour with numpy bincount that I cannot make sense of. I want to bin the values in a 2D array in a row-wise manner and see the behaviour below.

Can PostgreSQL array be optimized for join?

I see that PostgreSQL array is good for performance if the array's element is the data itself, e.g., tag http://shon.github.io/2015/12/21/postgres_array_perform

How to merge two arrays in Java?

Its not to concatenate but to merge two arrays so that they become array of name value pairs. firstarray = ["a","aa","aaa"] secondarray = ["b","bb","bbb"] resu

Yii model to array?

How can I convert the result of Trips::model()->findAll() to an array?