“array gabungan” Kode Jawaban

Bergabunglah dengan dua array 2d numpy

import numpy as np

a = np.array([[0, 1, 3], [5, 7, 9]])
b = np.array([[0, 2, 4], [6, 8, 10]])
c = np.concatenate((a, b), axis=0)
print(c)

Output : 
[[ 0  1  3]
 [ 5  7  9]
 [ 0  2  4]
 [ 6  8 10]]
FancyJump

Gabungkan dua array javascript

let arr1 = [0, 1, 2];
let arr2 = [3, 5, 7];
let primes = arr1.concat(arr2);

// > [0, 1, 2, 3, 5, 7]
Arab Fire Shaman

array gabungan

let arr1 = [0, 1, 2];
let arr2 = [3, 4, 5];

//  Append all items from arr2 onto arr1
arr1 = arr1.concat(arr2);
Mystic Dev

array gabungan

#// required library
import numpy as npy

#// define 3 (1D) numpy arrays
arr1 = npy.array([10, 20, 30])
arr2 = npy.array([40, 50, 60])
arr3 = npy.array([70, 80, 90])

arrCon = npy.concatenate([arr1, arr2, arr3])
print(arrCon)

#// concatenation can also happen with 2D arrays
arr1_2d = npy.array([
  [10, 20, 30],
  [40, 50, 60]
])
arr2_2d = npy.array([
  [11, 22, 33],
  [44, 55, 66]
])

arr_2dCon = npy.concatenate([arr1_2d, arr2_2d])
print(arr_2dCon)
ST111

array gabungan

let arr1 = [0, 1, 2];
let arr2 = [3, 4, 5];

arr1 = [...arr1, ...arr2];
//  arr1 is now [0, 1, 2, 3, 4, 5]
// Note: Not to use const otherwise, it will give TypeError (invalid assignment)
Mystic Dev

Jawaban yang mirip dengan “array gabungan”

Pertanyaan yang mirip dengan “array gabungan”

Lebih banyak jawaban terkait untuk “array gabungan” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya