Python | Numpy np.ma.concatenate () method

Using the np.ma.concatenate() method, we can concatenate two arrays using the np.ma.concatenate () method.

Syntax: np.ma.concatenate ([list1, list2])
Return: Return the array after concatenation.

Example # 1:
In this example we can see that with np.ma.concatenate () we can get the merged array using this method.

# NumPy import

import numpy as np

import numpy.ma as ma

 

gfg1 = np.array ([ , 2 , 3 ])

gfg2 = np.array ([ 4 , 5 , 6 ])

 
# using the np.ma.concatenate () method

gfg = ma.concatenate ([gfg1, gfg2])

 

print (gfg )

Output:

[1 2 3 4 5 6]

Example # 2:

# NumPy import

import numpy as np

import numpy.ma as ma

 

gfg1 = np.array ([ 11 , 22 , 33 ])

gfg2 = np.array ([ 41 , 52 , 63 ])

 
# using the np.ma.concatenate () method 

gfg = ma.concatenate ([ [gfg1], [gfg2]])

 

print (gfg)

Logout:

[[11 22 33]
[41 52 63]]