Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

find number of common element in two python array

len([x for x in list1 if x in list2])
Comment

python common elements in two arrays

# using numpy
import numpy as np
a = np.array([1,2,3,2,3,4,3,4,5,6])
b = np.array([7,2,10,2,7,4,9,4,9,8])
# using intersect1d
print(np.intersect1d(a,b))
# output
# [2 4]
Comment

PREVIOUS NEXT
Code Example
Python :: move mouse round in python 
Python :: youtube upload python 
Python :: print hello world in python 
Python :: spread operator python 
Python :: create 2d list dictionary 
Python :: python get response headers 
Python :: pandas drop rows with value in list 
Python :: nltk in python 
Python :: Print the norm of a vector and a matrix using numpy. 
Python :: python palindrome string 
Python :: combine dataframes 
Python :: Get a random joke in python 
Python :: python close browser 
Python :: discord py color 
Python :: datetimes to day of year python 
Python :: df concat 
Python :: python find specific file in directory 
Python :: python class name 
Python :: python weekday 
Python :: Inheritance constructor with parameters python 
Python :: converting month number to month name python 
Python :: how to take unknown number of inputs in python 
Python :: multiple functions tkinter 
Python :: python largest value in list 
Python :: pandas change multiple column types 
Python :: pynput.keyboard.Key 
Python :: python for loop in one line 
Python :: check pandas version 
Python :: how to use ggplot matplotlib 
Python :: how to plot corilation python 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =