Orta seviye
4 Ekim 2026Hatayı bul: Data Science & ML
Tek bir kod parçası. Hatayı bul ya da hata olmadığını kanıtla.
python
1import pandas as pd
2
3def enrich_orders_with_customer_emails(conn, orders: pd.DataFrame) -> pd.DataFrame:
4 cursor = conn.cursor()
5 emails = []
6 for _, row in orders.iterrows():
7 cursor.execute("SELECT email FROM customers WHERE id = %s", (row["customer_id"],))
8 result = cursor.fetchone()
9 emails.append(result[0] if result else None)
10 orders["email"] = emails
11 cursor.close()
12 return orders
13Soruna yol açan satırlara tıkla.
Kararın
Günde bir deneme. Cevap hemen ardından görünür.
Serini koru
Serini korumak ve ilerlemeni takip etmek için hesap oluştur.