File tree 3 files changed +39
-0
lines changed
solution/0500-0599/0511.Game Play Analysis I
3 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -69,4 +69,19 @@ FROM Activity
69
69
GROUP BY 1 ;
70
70
```
71
71
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
+
72
87
<!-- tabs:end -->
Original file line number Diff line number Diff line change @@ -70,4 +70,19 @@ FROM Activity
70
70
GROUP BY 1 ;
71
71
```
72
72
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
+
73
88
<!-- tabs:end -->
Original file line number Diff line number Diff line change
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
+ )
You can’t perform that action at this time.
0 commit comments