File tree 6 files changed +76
-0
lines changed
0183.Customers Who Never Order
6 files changed +76
-0
lines changed Original file line number Diff line number Diff line change 83
83
WHERE p1 .id != p2 .id AND p1 .email = p2 .email ;
84
84
```
85
85
86
+ ``` python
87
+ import pandas as pd
88
+
89
+
90
+ def duplicate_emails (person : pd.DataFrame) -> pd.DataFrame:
91
+ results = pd.DataFrame()
92
+
93
+ results = person.loc[person.duplicated(subset = [" email" ]), [" email" ]]
94
+
95
+ return results.drop_duplicates()
96
+
97
+ ```
98
+
86
99
<!-- tabs:end -->
Original file line number Diff line number Diff line change 77
77
WHERE p1 .id != p2 .id AND p1 .email = p2 .email ;
78
78
```
79
79
80
+ ``` python
81
+ import pandas as pd
82
+
83
+
84
+ def duplicate_emails (person : pd.DataFrame) -> pd.DataFrame:
85
+ results = pd.DataFrame()
86
+
87
+ results = person.loc[person.duplicated(subset = [" email" ]), [" email" ]]
88
+
89
+ return results.drop_duplicates()
90
+
91
+ ```
92
+
80
93
<!-- tabs:end -->
Original file line number Diff line number Diff line change
1
+ import pandas as pd
2
+
3
+
4
+ def duplicate_emails (person : pd .DataFrame ) -> pd .DataFrame :
5
+ results = pd .DataFrame ()
6
+
7
+ results = person .loc [person .duplicated (subset = ["email" ]), ["email" ]]
8
+
9
+ return results .drop_duplicates ()
Original file line number Diff line number Diff line change @@ -105,4 +105,19 @@ FROM
105
105
WHERE o .id IS NULL ;
106
106
```
107
107
108
+ ``` python
109
+ import pandas as pd
110
+
111
+
112
+ def find_customers (customers : pd.DataFrame, orders : pd.DataFrame) -> pd.DataFrame:
113
+ # Select the customers whose 'id' is not present in the orders DataFrame's 'customerId' column.
114
+ df = customers[~ customers[" id" ].isin(orders[" customerId" ])]
115
+
116
+ # Build a DataFrame that only contains the 'name' column and rename it as 'Customers'.
117
+ df = df[[" name" ]].rename(columns = {" name" : " Customers" })
118
+
119
+ return df
120
+
121
+ ```
122
+
108
123
<!-- tabs:end -->
Original file line number Diff line number Diff line change @@ -105,4 +105,19 @@ FROM
105
105
WHERE o .id IS NULL ;
106
106
```
107
107
108
+ ``` python
109
+ import pandas as pd
110
+
111
+
112
+ def find_customers (customers : pd.DataFrame, orders : pd.DataFrame) -> pd.DataFrame:
113
+ # Select the customers whose 'id' is not present in the orders DataFrame's 'customerId' column.
114
+ df = customers[~ customers[" id" ].isin(orders[" customerId" ])]
115
+
116
+ # Build a DataFrame that only contains the 'name' column and rename it as 'Customers'.
117
+ df = df[[" name" ]].rename(columns = {" name" : " Customers" })
118
+
119
+ return df
120
+
121
+ ```
122
+
108
123
<!-- tabs:end -->
Original file line number Diff line number Diff line change
1
+ import pandas as pd
2
+
3
+
4
+ def find_customers (customers : pd .DataFrame , orders : pd .DataFrame ) -> pd .DataFrame :
5
+ # Select the customers whose 'id' is not present in the orders DataFrame's 'customerId' column.
6
+ df = customers [~ customers ["id" ].isin (orders ["customerId" ])]
7
+
8
+ # Build a DataFrame that only contains the 'name' column and rename it as 'Customers'.
9
+ df = df [["name" ]].rename (columns = {"name" : "Customers" })
10
+
11
+ return df
You can’t perform that action at this time.
0 commit comments