Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to filter words that contain atleast 2 vowels from a series

# Input
ser = pd.Series(['Apple', 'Orange', 'Plan', 'Python', 'Money'])

# Solution
from collections import Counter
mask = ser.map(lambda x: sum([Counter(x.lower()).get(i, 0) for i in list('aeiou')]) >= 2)
ser[mask]
Source by www.machinelearningplus.com #
 
PREVIOUS NEXT
Tagged: #How #filter #words #atleast #vowels #series
ADD COMMENT
Topic
Name
9+6 =