HomeLanguagesPython | Numpy np.ma.concatenate() method

Python | Numpy np.ma.concatenate() method

With the help of np.ma.concatenate() method, we can concatenate two arrays with the help of 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 by using np.ma.concatenate() method, we are able to get the concatenate array with the help of this method.




# import numpy
import numpy as np
import numpy.ma as ma
  
gfg1 = np.array([1, 2, 3])
gfg2 = np.array([4, 5, 6])
  
# using np.ma.concatenate() method
gfg = ma.concatenate([gfg1, gfg2])
  
print(gfg)


Output :

[1 2 3 4 5 6]

Example #2 :




# import numpy
import numpy as np
import numpy.ma as ma
  
gfg1 = np.array([11, 22, 33])
gfg2 = np.array([41, 52, 63])
  
# using np.ma.concatenate() method
gfg = ma.concatenate([[gfg1], [gfg2]])
  
print(gfg)


Output :

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

Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

2 COMMENTS

Most Popular

Dominic
32686 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7052 POSTS0 COMMENTS
Nicole Veronica
12192 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12291 POSTS0 COMMENTS
Shaida Kate Naidoo
7178 POSTS0 COMMENTS
Ted Musemwa
7444 POSTS0 COMMENTS
Thapelo Manthata
7156 POSTS0 COMMENTS
Umr Jansen
7147 POSTS0 COMMENTS