Skip to content

Commit 9750047

Browse files
Qiu-ITyanglbme
andauthored
feat: add pandas py solution to lc problem: No.1757 (doocs#1395)
Co-authored-by: Yang Libin <contact@yanglibin.info>
1 parent 841f131 commit 9750047

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

solution/1700-1799/1757.Recyclable and Low Fat Products/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,16 @@ FROM Products
7070
WHERE low_fats = 'Y' AND recyclable = 'Y';
7171
```
7272

73+
### **PANDAS**
74+
75+
```python
76+
import pandas as pd
77+
78+
79+
def find_products(products: pd.DataFrame) -> pd.DataFrame:
80+
rs = products[(products["low_fats"] == "Y") & (products["recyclable"] == "Y")]
81+
rs = rs[["product_id"]]
82+
return rs
83+
```
84+
7385
<!-- tabs:end -->

solution/1700-1799/1757.Recyclable and Low Fat Products/README_EN.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,16 @@ FROM Products
6464
WHERE low_fats = 'Y' AND recyclable = 'Y';
6565
```
6666

67+
### **PANDAS**
68+
69+
```python
70+
import pandas as pd
71+
72+
73+
def find_products(products: pd.DataFrame) -> pd.DataFrame:
74+
rs = products[(products["low_fats"] == "Y") & (products["recyclable"] == "Y")]
75+
rs = rs[["product_id"]]
76+
return rs
77+
```
78+
6779
<!-- tabs:end -->
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pandas as pd
2+
3+
4+
def find_products(products: pd.DataFrame) -> pd.DataFrame:
5+
rs = products[(products["low_fats"] == "Y") & (products["recyclable"] == "Y")]
6+
rs = rs[["product_id"]]
7+
return rs

0 commit comments

Comments
 (0)