Concatenating the data

NumPy's concatenate data is used to concatenate two arrays either row-wise or column-wise. It can take two or more arrays of the same shape and it concatenates row-wise as a default type i.e. axis=0.

Example1:

Output:

array([[ 0,  1,  2],
       [ 3,  4,  5],
       [ 6,  7,  8],
       [10, 11, 12],
       [13, 14, 15],
       [16, 17, 18]])

Example2:

Output:

    Name     id
A   Parker   108
B   Phill    119
C   Smith    127
A   Terry    102
B   Jones    125
C   John     112

Example3:

Output:

 Name   id
x A  Parker  108
B   Phill119
 C   Smith  127
y A   Terry  102
 B   Jones  125
C    John  112

Next TopicPandas vs NumPy




Latest Courses