diff --git a/docs/getting-started/sportec.ipynb b/docs/getting-started/sportec.ipynb index 399f8bb4..51227d12 100644 --- a/docs/getting-started/sportec.ipynb +++ b/docs/getting-started/sportec.ipynb @@ -7,13 +7,13 @@ "source": [ "# Sportec\n", "\n", - "## Load local files" + "## Load local event files" ] }, { "cell_type": "code", "execution_count": 1, - "id": "e9adb7cb", + "id": "4f6455fb", "metadata": {}, "outputs": [ { @@ -77,7 +77,7 @@ " 38.71\n", " DFL-OBJ-0000ZS\n", " KICK_OFF\n", - " NaN\n", + " None\n", " \n", " \n", " 1\n", @@ -97,8 +97,8 @@ " NaN\n", " NaN\n", " DFL-OBJ-002G3I\n", - " NaN\n", - " NaN\n", + " None\n", + " None\n", " \n", " \n", " 2\n", @@ -119,7 +119,7 @@ " 28.58\n", " DFL-OBJ-0027B9\n", " THROW_IN\n", - " NaN\n", + " None\n", " \n", " \n", " 3\n", @@ -138,8 +138,8 @@ " 28.58\n", " NaN\n", " NaN\n", - " NaN\n", - " NaN\n", + " None\n", + " None\n", " RIGHT_FOOT\n", " \n", " \n", @@ -160,8 +160,8 @@ " NaN\n", " NaN\n", " None\n", - " NaN\n", - " NaN\n", + " None\n", + " None\n", " \n", " \n", "\n", @@ -190,11 +190,11 @@ "4 8.72 4.21 NaN NaN \n", "\n", " receiver_player_id set_piece_type body_part_type \n", - "0 DFL-OBJ-0000ZS KICK_OFF NaN \n", - "1 DFL-OBJ-002G3I NaN NaN \n", - "2 DFL-OBJ-0027B9 THROW_IN NaN \n", - "3 NaN NaN RIGHT_FOOT \n", - "4 None NaN NaN " + "0 DFL-OBJ-0000ZS KICK_OFF None \n", + "1 DFL-OBJ-002G3I None None \n", + "2 DFL-OBJ-0027B9 THROW_IN None \n", + "3 None None RIGHT_FOOT \n", + "4 None None None " ] }, "execution_count": 1, @@ -205,7 +205,7 @@ "source": [ "from kloppy import sportec\n", "\n", - "dataset = sportec.load(\n", + "dataset = sportec.load_event(\n", " event_data=\"../../kloppy/tests/files/sportec_events.xml\",\n", " meta_data=\"../../kloppy/tests/files/sportec_meta.xml\",\n", " \n", @@ -216,6 +216,258 @@ "\n", "dataset.to_df().head()" ] + }, + { + "cell_type": "markdown", + "id": "81989fc6", + "metadata": {}, + "source": [ + "# Load local tracking files" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "958f17ee", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
period_idtimestampframe_idball_stateball_owning_team_idball_xball_yball_zball_speedDFL-OBJ-002G3I_x...DFL-OBJ-002G3I_dDFL-OBJ-002G3I_sDFL-OBJ-002G5S_xDFL-OBJ-002G5S_yDFL-OBJ-002G5S_dDFL-OBJ-002G5S_sDFL-OBJ-002FVJ_xDFL-OBJ-002FVJ_yDFL-OBJ-002FVJ_dDFL-OBJ-002FVJ_s
010.0010000deadDFL-CLU-0000042.690.260.060.000.35...None0.00NaNNaNNoneNaNNaNNaNNoneNaN
110.0410001aliveDFL-CLU-00000A3.410.260.0865.590.34...None1.74NaNNaNNoneNaNNaNNaNNoneNaN
210.0810002aliveDFL-CLU-0000044.220.330.0965.160.32...None1.76NaNNaNNoneNaNNaNNaNNoneNaN
310.1210003aliveDFL-CLU-0000045.020.380.0974.340.31...None1.78NaNNaNNoneNaNNaNNaNNoneNaN
410.1610004aliveDFL-CLU-0000045.790.440.0873.580.29...None1.80NaNNaNNoneNaNNaNNaNNoneNaN
\n", + "

5 rows × 21 columns

\n", + "
" + ], + "text/plain": [ + " period_id timestamp frame_id ball_state ball_owning_team_id ball_x \\\n", + "0 1 0.00 10000 dead DFL-CLU-000004 2.69 \n", + "1 1 0.04 10001 alive DFL-CLU-00000A 3.41 \n", + "2 1 0.08 10002 alive DFL-CLU-000004 4.22 \n", + "3 1 0.12 10003 alive DFL-CLU-000004 5.02 \n", + "4 1 0.16 10004 alive DFL-CLU-000004 5.79 \n", + "\n", + " ball_y ball_z ball_speed DFL-OBJ-002G3I_x ... DFL-OBJ-002G3I_d \\\n", + "0 0.26 0.06 0.00 0.35 ... None \n", + "1 0.26 0.08 65.59 0.34 ... None \n", + "2 0.33 0.09 65.16 0.32 ... None \n", + "3 0.38 0.09 74.34 0.31 ... None \n", + "4 0.44 0.08 73.58 0.29 ... None \n", + "\n", + " DFL-OBJ-002G3I_s DFL-OBJ-002G5S_x DFL-OBJ-002G5S_y DFL-OBJ-002G5S_d \\\n", + "0 0.00 NaN NaN None \n", + "1 1.74 NaN NaN None \n", + "2 1.76 NaN NaN None \n", + "3 1.78 NaN NaN None \n", + "4 1.80 NaN NaN None \n", + "\n", + " DFL-OBJ-002G5S_s DFL-OBJ-002FVJ_x DFL-OBJ-002FVJ_y DFL-OBJ-002FVJ_d \\\n", + "0 NaN NaN NaN None \n", + "1 NaN NaN NaN None \n", + "2 NaN NaN NaN None \n", + "3 NaN NaN NaN None \n", + "4 NaN NaN NaN None \n", + "\n", + " DFL-OBJ-002FVJ_s \n", + "0 NaN \n", + "1 NaN \n", + "2 NaN \n", + "3 NaN \n", + "4 NaN \n", + "\n", + "[5 rows x 21 columns]" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "from kloppy import sportec\n", + "\n", + "\n", + "dataset = sportec.load_tracking(\n", + " raw_data=\"../../kloppy/tests/files/sportec_positional.xml\",\n", + " meta_data=\"../../kloppy/tests/files/sportec_meta.xml\",\n", + " \n", + " # Optional arguments\n", + " coordinates=\"sportec\",\n", + " only_alive=False\n", + ")\n", + "\n", + "dataset.to_df().head()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "366f1126", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {