Skip to content

Commit 55fc28f

Browse files
committed
Added solution of problem 1581
1 parent 4e9b8a4 commit 55fc28f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import pandas as pd
2+
3+
4+
def find_customers(visits: pd.DataFrame, transactions: pd.DataFrame) -> pd.DataFrame:
5+
df = visits.merge(transactions, how="left")
6+
return (
7+
df[df["transaction_id"].isna()]
8+
.groupby(["customer_id"], as_index=False)
9+
.agg(count_no_trans=("visit_id", "nunique"))
10+
)

0 commit comments

Comments
 (0)