﻿ Pandas Data Series: Filter words from a given series that contain atleast two vowels - w3resource # Pandas Data Series: Filter words from a given series that contain atleast two vowels

## Pandas: Data Series Exercise-30 with Solution

Write a Pandas program to filter words from a given series that contain atleast two vowels.

Sample Solution :

Python Code :

``````import pandas as pd
from collections import Counter
color_series = pd.Series(['Red', 'Green', 'Orange', 'Pink', 'Yellow', 'White'])
print("Original Series:")
print(color_series)
print("\nFiltered words:")
result = mask = color_series.map(lambda c: sum([Counter(c.lower()).get(i, 0) for i in list('aeiou')]) >= 2)
print(color_series[result])
``````

Sample Output:

```Original Series:
0       Red
1     Green
2    Orange
3      Pink
4    Yellow
5     White
dtype: object

Filtered words:
1     Green
2    Orange
4    Yellow
5     White
dtype: object
```

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

What is the difficulty level of this exercise?

Test your Python skills with w3resource's quiz

﻿

## Python: Tips of the Day

Returns a list with n elements removed from the beginning

Example:

```def tips_take(itr, n = 1):
return itr[:n]
print(tips_take([1, 2, 3], 5))
print(tips_take([1, 2, 3], 0))
```

Output:

```[1, 2, 3]
[]
```