Search
 
SCRIPT & CODE EXAMPLE
 

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]
Comment

PREVIOUS NEXT
Code Example
Python :: clone dict python 
Python :: Python Print Variable Using the string formatting with positional arguments {} 
Python :: python test class hashable 
Python :: dockerize django app 
Python :: saving model 
Python :: max element in dictionary python 
Python :: telegram.ext package 
Python :: pandas define how you want to aggregate each column 
Python :: index in the pool python 
Python :: How To Let Your Main Window Appear after succesful login in Tkinter 
Python :: change gles3 to gles2 
Python :: os.path.dirname(__file__) 
Python :: combine column in csv python pandas 
Python :: python map function 
Python :: pyqt button hover color 
Python :: tkinter fenstertitel 
Python :: python code to demonstrate inheritance with animal class 
Python :: python remove vowels from string 
Python :: import python code from another directory 
Python :: CMake Error at pybind11/tools/FindPythonLibsNew.cmake:131 (message): Python config failure: 
Python :: smote on dataframe of feature 
Python :: accessing values in dictionary python 
Python :: what are postcondition errors in python 
Python :: how to set date and time rows in order python pandas 
Python :: how to change theme of jupyter notebook 
Python :: write code in python to Open all links on a page in separate browser tabs 
Python :: python iterate over tuple of lists 
Python :: dataframe divided by rowsum 
Python :: print f python 
Python :: python kubernetes client find pod with name 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =