Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b09e870

Browse files
authored
feat: add pandas solution to lc problem: No.0511 (doocs#1890)
1 parent 8f7ca43 commit b09e870

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed

‎solution/0500-0599/0511.Game Play Analysis I/README.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,19 @@ FROM Activity
6969
GROUP BY 1;
7070
```
7171

72+
### **Pandas**
73+
74+
```python
75+
import pandas as pd
76+
77+
78+
def game_analysis(activity: pd.DataFrame) -> pd.DataFrame:
79+
return (
80+
activity.groupby("player_id")
81+
.agg(first_login=("event_date", "min"))
82+
.reset_index()
83+
)
84+
85+
```
86+
7287
<!-- tabs:end -->

‎solution/0500-0599/0511.Game Play Analysis I/README_EN.md‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,19 @@ FROM Activity
7070
GROUP BY 1;
7171
```
7272

73+
### **Pandas**
74+
75+
```python
76+
import pandas as pd
77+
78+
79+
def game_analysis(activity: pd.DataFrame) -> pd.DataFrame:
80+
return (
81+
activity.groupby("player_id")
82+
.agg(first_login=("event_date", "min"))
83+
.reset_index()
84+
)
85+
86+
```
87+
7388
<!-- tabs:end -->
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import pandas as pd
2+
3+
4+
def game_analysis(activity: pd.DataFrame) -> pd.DataFrame:
5+
return (
6+
activity.groupby("player_id")
7+
.agg(first_login=("event_date", "min"))
8+
.reset_index()
9+
)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /