prices={
"Samsung 20": 300,
"Iphone 6S": 260,
"Lenovo Legion": 450
}
sells={
"Маша":"Samsung 20",
"Максим":"Iphone 6S",
"Наташа":"Lenovo Legion"
}
phones = [key for key, value in prices.items() if value < 350]
seller_names = [key for key, value in sells.items() if value in phones]
# Out: ['Маша', 'Максим']
sells={
... "Маша":"Samsung 20",
... "Максим":"Iphone 6S",
... "Наташа":"Lenovo Legion"
... }
prices={
... "Samsung 20": 300,
... "Iphone 6S": 260,
... "Lenovo Legion": 450
... }
result = [name for name, tel in sells.items() if prices.get(tel, 999) < 350]
>>> print(result)
['Маша', 'Максим']
df['date'] = pd.to_datetime(df[['year', 'month']].assign(day=1))