# Find common values between two NumPy arrays

• Last Updated : 29 Aug, 2020

In NumPy, we can find common values between two arrays with the help intersect1d(). It will take parameter two arrays and it will return an array in which all the common elements will appear.

Syntax: numpy.intersect1d(array1,array2)

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course

Parameter :Two arrays.

Return :An array in which all the common element will appear.

Example 1:

## Python

 `import` `numpy as np`` ` ` ` `ar1 ``=` `np.array([``0``, ``1``, ``2``, ``3``, ``4``])``ar2 ``=` `[``1``, ``3``, ``4``]`` ` `# Common values between two arrays``print``(np.intersect1d(ar1, ar2))`

Output:

```[1,3,4]
```

Example 2:

## Python

 `import` `numpy as np`` ` ` ` `ar1 ``=` `np.array([``12``, ``14``, ``15``, ``16``, ``17``])``ar2 ``=` `[``2``, ``4``, ``5``, ``6``, ``7``, ``8``, ``9``, ``12``]`` ` `# Common values between two arrays``print``(np.intersect1d(ar1, ar2))`

Output:

```
```

My Personal Notes arrow_drop_up