fuzzy match pandas python ai code example
Example: python - matching people based on city
students = [
{
'name': 'Sarah',
'city': 'Manchester'
},
{
'name': 'Mary',
'city': 'London'
}
,
{
'name': 'Charlotte',
'city': 'Paris'
},
{
'name': 'Carl',
'city': 'Paris'
}
]
my_location = input('Which is your location? ')
match_location = [student for student in students if student['city'] == my_location]
if len(match_location) > 0:
print('The location is:')
if any(match_location):
print('The location is:')