Skip to content

Commit

Permalink
Update docs and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
koenvo committed Mar 5, 2023
1 parent a463385 commit 9f3ea61
Show file tree
Hide file tree
Showing 20 changed files with 1,054 additions and 807 deletions.
94 changes: 47 additions & 47 deletions docs/examples/broadcast_tracking_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 1,
"metadata": {
"scrolled": true
},
Expand All @@ -49,7 +49,7 @@
" raw_data=tracking_file,\n",
" limit=100)\n",
"\n",
"df = dataset.to_pandas()"
"df = dataset.to_df()"
]
},
{
Expand All @@ -63,7 +63,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -89,7 +89,7 @@
" 'Serge Gnabry (22)']"
]
},
"execution_count": 5,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -103,7 +103,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -135,7 +135,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -173,7 +173,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand All @@ -199,14 +199,14 @@
" <th></th>\n",
" <th>period_id</th>\n",
" <th>timestamp</th>\n",
" <th>frame_id</th>\n",
" <th>ball_state</th>\n",
" <th>ball_owning_team_id</th>\n",
" <th>ball_x</th>\n",
" <th>ball_y</th>\n",
" <th>ball_z</th>\n",
" <th>away_23_x</th>\n",
" <th>away_23_y</th>\n",
" <th>away_23_d</th>\n",
" <th>away_23_s</th>\n",
" <th>...</th>\n",
" <th>away_14_d</th>\n",
" <th>away_14_s</th>\n",
Expand All @@ -225,14 +225,14 @@
" <th>0</th>\n",
" <td>1</td>\n",
" <td>11.2</td>\n",
" <td>1523</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>0.747489</td>\n",
" <td>0.098509</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -249,14 +249,14 @@
" <th>1</th>\n",
" <td>1</td>\n",
" <td>11.3</td>\n",
" <td>1524</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>0.791347</td>\n",
" <td>-0.020033</td>\n",
" <td>2.243712</td>\n",
" <td>0.745323</td>\n",
" <td>0.099367</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -273,14 +273,14 @@
" <th>2</th>\n",
" <td>1</td>\n",
" <td>11.4</td>\n",
" <td>1525</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>0.772630</td>\n",
" <td>-0.009469</td>\n",
" <td>2.534799</td>\n",
" <td>0.742956</td>\n",
" <td>0.099743</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -297,14 +297,14 @@
" <th>3</th>\n",
" <td>1</td>\n",
" <td>11.5</td>\n",
" <td>1526</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>0.754625</td>\n",
" <td>0.001612</td>\n",
" <td>2.659813</td>\n",
" <td>0.740386</td>\n",
" <td>0.099638</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -321,14 +321,14 @@
" <th>4</th>\n",
" <td>1</td>\n",
" <td>11.6</td>\n",
" <td>1527</td>\n",
" <td>None</td>\n",
" <td>NaN</td>\n",
" <td>0.737330</td>\n",
" <td>0.013210</td>\n",
" <td>2.618755</td>\n",
" <td>0.737875</td>\n",
" <td>0.096646</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>...</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
Expand All @@ -343,42 +343,42 @@
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 90 columns</p>\n",
"<p>5 rows × 92 columns</p>\n",
"</div>"
],
"text/plain": [
" period_id timestamp ball_state ball_owning_team_id ball_x ball_y \\\n",
"0 1 11.2 None NaN NaN NaN \n",
"1 1 11.3 None NaN 0.791347 -0.020033 \n",
"2 1 11.4 None NaN 0.772630 -0.009469 \n",
"3 1 11.5 None NaN 0.754625 0.001612 \n",
"4 1 11.6 None NaN 0.737330 0.013210 \n",
" period_id timestamp frame_id ball_state ball_owning_team_id ball_x \\\n",
"0 1 11.2 1523 None NaN NaN \n",
"1 1 11.3 1524 None NaN 0.791347 \n",
"2 1 11.4 1525 None NaN 0.772630 \n",
"3 1 11.5 1526 None NaN 0.754625 \n",
"4 1 11.6 1527 None NaN 0.737330 \n",
"\n",
" away_23_x away_23_y away_23_d away_23_s ... away_14_d away_14_s \\\n",
"0 0.747489 0.098509 NaN NaN ... NaN NaN \n",
"1 0.745323 0.099367 NaN NaN ... NaN NaN \n",
"2 0.742956 0.099743 NaN NaN ... NaN NaN \n",
"3 0.740386 0.099638 NaN NaN ... NaN NaN \n",
"4 0.737875 0.096646 NaN NaN ... NaN NaN \n",
" ball_y ball_z away_23_x away_23_y ... away_14_d away_14_s \\\n",
"0 NaN NaN 0.747489 0.098509 ... NaN NaN \n",
"1 -0.020033 2.243712 0.745323 0.099367 ... NaN NaN \n",
"2 -0.009469 2.534799 0.742956 0.099743 ... NaN NaN \n",
"3 0.001612 2.659813 0.740386 0.099638 ... NaN NaN \n",
"4 0.013210 2.618755 0.737875 0.096646 ... NaN NaN \n",
"\n",
" home_9_x home_9_y home_9_d home_9_s home_anon_75_x home_anon_75_y \\\n",
"0 NaN NaN NaN NaN NaN NaN \n",
"1 NaN NaN NaN NaN NaN NaN \n",
"2 NaN NaN NaN NaN NaN NaN \n",
"3 NaN NaN NaN NaN NaN NaN \n",
"4 NaN NaN NaN NaN NaN NaN \n",
" home_9_x home_9_y home_9_d home_9_s home_anon_75_x home_anon_75_y \\\n",
"0 NaN NaN NaN NaN NaN NaN \n",
"1 NaN NaN NaN NaN NaN NaN \n",
"2 NaN NaN NaN NaN NaN NaN \n",
"3 NaN NaN NaN NaN NaN NaN \n",
"4 NaN NaN NaN NaN NaN NaN \n",
"\n",
" home_anon_75_d home_anon_75_s \n",
"0 NaN NaN \n",
"1 NaN NaN \n",
"2 NaN NaN \n",
"3 NaN NaN \n",
"4 NaN NaN \n",
" home_anon_75_d home_anon_75_s \n",
"0 NaN NaN \n",
"1 NaN NaN \n",
"2 NaN NaN \n",
"3 NaN NaN \n",
"4 NaN NaN \n",
"\n",
"[5 rows x 90 columns]"
"[5 rows x 92 columns]"
]
},
"execution_count": 10,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -411,7 +411,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
"version": "3.10.6"
},
"toc": {
"base_numbering": 1,
Expand Down
36 changes: 25 additions & 11 deletions docs/examples/code_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@
}
],
"source": [
"code_dataset.to_pandas()"
"code_dataset.to_df()"
]
},
{
Expand Down Expand Up @@ -279,7 +279,7 @@
],
"source": [
"passes = code_dataset.filter(lambda code: code.code == 'PASS')\n",
"passes.to_pandas()"
"passes.to_df()"
]
},
{
Expand Down Expand Up @@ -359,9 +359,23 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 6,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/Users/koen/Developer/Projects/PySport/kloppy/.venv/lib/python3.10/site-packages/kloppy-3.7.1-py3.10.egg/kloppy/_providers/statsbomb.py:67: UserWarning: \n",
"\n",
"You are about to use StatsBomb public data.\n",
"By using this data, you are agreeing to the user agreement. \n",
"The user agreement can be found here: https://github.com/statsbomb/open-data/blob/master/LICENSE.pdf\n",
"\n",
" warnings.warn(\n"
]
}
],
"source": [
"from kloppy import statsbomb\n",
"\n",
Expand All @@ -370,7 +384,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -405,7 +419,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -785,18 +799,18 @@
"27 Lionel Andrés Messi Cuccittini Barcelona "
]
},
"execution_count": 14,
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"code_dataset.to_pandas()"
"code_dataset.to_df()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1213,7 +1227,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -1245,7 +1259,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.9"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 9f3ea61

Please sign in to comment.