numpy.concatenate()> La fonction concatène une séquence de tableaux le long d’un axe existant.
Syntaxe : numpy.concatenate((arr1, arr2, …), axis=0, out=Aucun)
Paramètres :
arr1, arr2, … : [séquence de array_like] Les tableaux doivent avoir la même forme, sauf dans la dimension correspondant à l'axe.
axe : [int, facultatif] L'axe le long duquel les tableaux seront joints. Si l'axe est Aucun, les tableaux sont aplatis avant utilisation. La valeur par défaut est 0.
dehors : [ndarray, facultatif] Si fourni, la destination où placer le résultat. La forme doit être correcte, correspondant à celle de ce que concatenate aurait renvoyé si aucun argument out n'avait été spécifié.
Retour : [ndarray] Le tableau concaténé.
Code #1 :
Logique du 1er ordre
# Python program explaining> # numpy.concatenate() function> > # importing numpy as geek> import> numpy as geek> > arr1>=> geek.array([[>2>,>4>], [>6>,>8>]])> arr2>=> geek.array([[>3>,>5>], [>7>,>9>]])> > gfg>=> geek.concatenate((arr1, arr2), axis>=> 0>)> > print> (gfg)> |
>
>
Sortir :
[[2 4] [6 8] [3 5] [7 9]]>
Code #2 :
# Python program explaining> # numpy.concatenate() function> > # importing numpy as geek> import> numpy as geek> > arr1>=> geek.array([[>2>,>4>], [>6>,>8>]])> arr2>=> geek.array([[>3>,>5>], [>7>,>9>]])> > gfg>=> geek.concatenate((arr1, arr2), axis>=> 1>)> > print> (gfg)> |
>
>
Sortir :
[[2 4 3 5] [6 8 7 9]]>
Code #3 :
# Python program explaining> # numpy.concatenate() function> > # importing numpy as geek> import> numpy as geek> > arr1>=> geek.array([[>2>,>4>], [>6>,>8>]])> arr2>=> geek.array([[>3>,>5>], [>7>,>9>]])> > gfg>=> geek.concatenate((arr1, arr2), axis>=> None>)> > print> (gfg)> |
>
>
Sortir :
trouver des numéros bloqués sur Android
[2 4 6 8 3 5 7 9]>