I have a CSV file that has data about users. and I want to filter them by name endings. it is an example of my CSV file:
index, name, id, status
1, John, 500, online
2, Anne, 485, offline
3, Angel, 856, online
4, Lusia, 777, offline
from this, I want to get only names that have vowel endings. I expected this result:
index, name, id, status
1, Anne, 485, offline
2, Lusia, 777, offline
that's why I have used python which is in the example:
output is:
index, name, id, status
"2," "Anne," "485," "offline"
"4," "Lusia," "777," "offline"
So problems are:
the numbers are not in the correct order.
as you can see each row has the addition of " " symbol how can I fix this? please give me solutions:)
What I have tried:
import csv
import pandas
df = pandas.read_csv('us.csv')
filtereddf = df[df.name.str[-1].apply(lambda x: x in ['a', 'e', 'i', 'o', 'u','а', 'и', 'е', 'я', 'у', 'о', 'ё', 'A','E', 'I', 'O'])]
filtereddf.to_csv('output_filtered_sample1.csv', index=False, quoting=1)