{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Parsing a Counter-Strike 2 Demo\n", "\n", "In this notebook, we show how to install Awpy and parse a Counter-Strike 2 demo file, also called a replay file or simply, demo. To start, install Awpy via pip by running `pip install awpy`. Python >= 3.11 is a prerequisite! You can get a demo either through the game itself, or by visiting a website like [HLTV](https://www.hltv.org/) or [FACEIT](https://www.faceit.com/). Then, to parse the demo, you can run the following:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m2025-02-17 11:27:34.708\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mawpy.demo\u001b[0m:\u001b[36mparse\u001b[0m:\u001b[36m214\u001b[0m - \u001b[34m\u001b[1mStarting to parse spirit-vs-natus-vincere-m2-dust2.dem\u001b[0m\n", "\u001b[32m2025-02-17 11:27:39.170\u001b[0m | \u001b[32m\u001b[1mSUCCESS \u001b[0m | \u001b[36mawpy.demo\u001b[0m:\u001b[36mparse\u001b[0m:\u001b[36m258\u001b[0m - \u001b[32m\u001b[1mFinished parsing spirit-vs-natus-vincere-m2-dust2.dem, took 4.46 seconds\u001b[0m\n", "\n", "Header: \n", "{'game_directory': '/home/csserver001/cs2/game/csgo', 'allow_clientside_entities': True, 'demo_version_guid': '8e9d71ab-04a1-4c01-bb61-acfede27c046', 'server_name': 'BLAST Premier 2024', 'demo_file_stamp': 'PBDEMS2\\x00', 'client_name': 'SourceTV Demo', 'allow_clientside_particles': True, 'fullpackets_version': '2', 'addons': '', 'demo_version_name': 'valve_demo_2', 'map_name': 'de_dust2', 'network_protocol': '14011'}\n", "\n", "Rounds: \n", "shape: (3, 9)\n", "┌───────────┬───────┬────────────┬───────┬───┬────────┬──────────┬────────────┬─────────────┐\n", "│ round_num ┆ start ┆ freeze_end ┆ end ┆ … ┆ winner ┆ reason ┆ bomb_plant ┆ bomb_site │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n", "│ u32 ┆ i32 ┆ i32 ┆ i32 ┆ ┆ str ┆ str ┆ i64 ┆ str │\n", "╞═══════════╪═══════╪════════════╪═══════╪═══╪════════╪══════════╪════════════╪═════════════╡\n", "│ 1 ┆ 576 ┆ 7461 ┆ 12853 ┆ … ┆ CT ┆ t_killed ┆ null ┆ not_planted │\n", "│ 2 ┆ 13301 ┆ 14581 ┆ 17224 ┆ … ┆ CT ┆ t_killed ┆ null ┆ not_planted │\n", "│ 3 ┆ 17672 ┆ 18952 ┆ 22872 ┆ … ┆ CT ┆ t_killed ┆ null ┆ not_planted │\n", "└───────────┴───────┴────────────┴───────┴───┴────────┴──────────┴────────────┴─────────────┘\n", "\n", "Kills: \n", "shape: (3, 41)\n", "┌────────────┬────────────┬────────────┬────────────┬───┬───────────┬───────────┬───────────┬──────┐\n", "│ assistedfl ┆ assister_X ┆ assister_Y ┆ assister_Z ┆ … ┆ weapon_fa ┆ weapon_it ┆ weapon_or ┆ wipe │\n", "│ ash ┆ --- ┆ --- ┆ --- ┆ ┆ uxitemid ┆ emid ┆ iginalown ┆ --- │\n", "│ --- ┆ f32 ┆ f32 ┆ f32 ┆ ┆ --- ┆ --- ┆ er_xuid ┆ i32 │\n", "│ bool ┆ ┆ ┆ ┆ ┆ str ┆ str ┆ --- ┆ │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ str ┆ │\n", "╞════════════╪════════════╪════════════╪════════════╪═══╪═══════════╪═══════════╪═══════════╪══════╡\n", "│ false ┆ null ┆ null ┆ null ┆ … ┆ 172938225 ┆ 327493063 ┆ ┆ 0 │\n", "│ ┆ ┆ ┆ ┆ ┆ 691435991 ┆ 75 ┆ ┆ │\n", "│ ┆ ┆ ┆ ┆ ┆ 44 ┆ ┆ ┆ │\n", "│ false ┆ null ┆ null ┆ null ┆ … ┆ 172938225 ┆ 327493063 ┆ ┆ 0 │\n", "│ ┆ ┆ ┆ ┆ ┆ 691435991 ┆ 75 ┆ ┆ │\n", "│ ┆ ┆ ┆ ┆ ┆ 44 ┆ ┆ ┆ │\n", "│ false ┆ null ┆ null ┆ null ┆ … ┆ 172938225 ┆ 374009057 ┆ ┆ 0 │\n", "│ ┆ ┆ ┆ ┆ ┆ 691357348 ┆ 41 ┆ ┆ │\n", "│ ┆ ┆ ┆ ┆ ┆ 45 ┆ ┆ ┆ │\n", "└────────────┴────────────┴────────────┴────────────┴───┴───────────┴───────────┴───────────┴──────┘\n", "\n", "Damages: \n", "shape: (3, 22)\n", "┌───────┬────────────┬────────────┬────────────┬───┬────────────┬────────────┬─────────┬───────────┐\n", "│ armor ┆ attacker_X ┆ attacker_Y ┆ attacker_Z ┆ … ┆ victim_nam ┆ victim_ste ┆ weapon ┆ dmg_healt │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ e ┆ amid ┆ --- ┆ h_real │\n", "│ i32 ┆ f32 ┆ f32 ┆ f32 ┆ ┆ --- ┆ --- ┆ str ┆ --- │\n", "│ ┆ ┆ ┆ ┆ ┆ str ┆ str ┆ ┆ i32 │\n", "╞═══════╪════════════╪════════════╪════════════╪═══╪════════════╪════════════╪═════════╪═══════════╡\n", "│ 85 ┆ -407.51477 ┆ -328.71130 ┆ 0.913547 ┆ … ┆ zont1x ┆ 7656119899 ┆ ssg08 ┆ 100 │\n", "│ ┆ 1 ┆ 4 ┆ ┆ ┆ ┆ 5880877 ┆ ┆ │\n", "│ 0 ┆ -462.22937 ┆ 28.99902 ┆ 0.499369 ┆ … ┆ donk ┆ 7656119838 ┆ ssg08 ┆ 31 │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ 6265483 ┆ ┆ │\n", "│ 100 ┆ 1593.97204 ┆ 1501.21667 ┆ 0.608216 ┆ … ┆ b1t ┆ 7656119824 ┆ hkp2000 ┆ 100 │\n", "│ ┆ 6 ┆ 5 ┆ ┆ ┆ ┆ 6607476 ┆ ┆ │\n", "└───────┴────────────┴────────────┴────────────┴───┴────────────┴────────────┴─────────┴───────────┘\n", "\n", "Weapon Fires: \n", "shape: (3, 10)\n", "┌──────────┬──────┬────────────┬────────────┬───┬────────────┬────────────┬────────────┬───────────┐\n", "│ silenced ┆ tick ┆ player_X ┆ player_Y ┆ … ┆ player_las ┆ player_nam ┆ player_ste ┆ weapon │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ t_place_na ┆ e ┆ amid ┆ --- │\n", "│ bool ┆ i32 ┆ f32 ┆ f32 ┆ ┆ me ┆ --- ┆ --- ┆ str │\n", "│ ┆ ┆ ┆ ┆ ┆ --- ┆ str ┆ str ┆ │\n", "│ ┆ ┆ ┆ ┆ ┆ str ┆ ┆ ┆ │\n", "╞══════════╪══════╪════════════╪════════════╪═══╪════════════╪════════════╪════════════╪═══════════╡\n", "│ false ┆ 41 ┆ -407.51477 ┆ -328.71130 ┆ … ┆ TopofMid ┆ b1t ┆ 7656119824 ┆ weapon_ss │\n", "│ ┆ ┆ 1 ┆ 4 ┆ ┆ ┆ ┆ 6607476 ┆ g08 │\n", "│ false ┆ 128 ┆ -413.88311 ┆ 1693.21997 ┆ … ┆ MidDoors ┆ donk ┆ 7656119838 ┆ weapon_aw │\n", "│ ┆ ┆ 8 ┆ 1 ┆ ┆ ┆ ┆ 6265483 ┆ p │\n", "│ false ┆ 214 ┆ 195.1064 ┆ -357.82635 ┆ … ┆ OutsideLon ┆ w0nderful ┆ 7656119906 ┆ weapon_kn │\n", "│ ┆ ┆ ┆ 5 ┆ ┆ g ┆ ┆ 3068840 ┆ ife_m9_ba │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ yonet │\n", "└──────────┴──────┴────────────┴────────────┴───┴────────────┴────────────┴────────────┴───────────┘\n", "\n", "Bomb: \n", "shape: (3, 8)\n", "┌──────┬────────┬─────────────┬─────────────┬────────────┬──────────────────┬───────────┬──────────┐\n", "│ tick ┆ event ┆ X ┆ Y ┆ Z ┆ steamid ┆ name ┆ bombsite │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- ┆ --- │\n", "│ i32 ┆ str ┆ f32 ┆ f32 ┆ f32 ┆ str ┆ str ┆ str │\n", "╞══════╪════════╪═════════════╪═════════════╪════════════╪══════════════════╪═══════════╪══════════╡\n", "│ 449 ┆ pickup ┆ -367.0 ┆ -808.0 ┆ 83.744965 ┆ 7656119817687830 ┆ jL ┆ null │\n", "│ ┆ ┆ ┆ ┆ ┆ 3 ┆ ┆ │\n", "│ 7503 ┆ drop ┆ -639.103088 ┆ -832.525757 ┆ 116.030685 ┆ 7656119906306884 ┆ w0nderful ┆ null │\n", "│ ┆ ┆ ┆ ┆ ┆ 0 ┆ ┆ │\n", "│ 7569 ┆ pickup ┆ -167.492432 ┆ -806.045715 ┆ 34.974846 ┆ 7656119801324332 ┆ Aleksib ┆ null │\n", "│ ┆ ┆ ┆ ┆ ┆ 6 ┆ ┆ │\n", "└──────┴────────┴─────────────┴─────────────┴────────────┴──────────────────┴───────────┴──────────┘\n", "\n", "Smokes: \n", "shape: (3, 13)\n", "┌───────────┬───────────┬──────────┬───────────┬───┬───────────┬───────────┬───────────┬───────────┐\n", "│ entity_id ┆ start_tic ┆ end_tick ┆ thrower_X ┆ … ┆ thrower_s ┆ X ┆ Y ┆ Z │\n", "│ --- ┆ k ┆ --- ┆ --- ┆ ┆ teamid ┆ --- ┆ --- ┆ --- │\n", "│ i64 ┆ --- ┆ i64 ┆ f64 ┆ ┆ --- ┆ f64 ┆ f64 ┆ f64 │\n", "│ ┆ i64 ┆ ┆ ┆ ┆ str ┆ ┆ ┆ │\n", "╞═══════════╪═══════════╪══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡\n", "│ 219 ┆ 9601 ┆ 11013 ┆ 847.12634 ┆ … ┆ 765611990 ┆ 394.15988 ┆ 1967.7786 ┆ 98.03125 │\n", "│ ┆ ┆ ┆ 3 ┆ ┆ 63238565 ┆ 2 ┆ 87 ┆ │\n", "│ 108 ┆ 11885 ┆ 13297 ┆ -1508.248 ┆ … ┆ 765611980 ┆ -1286.896 ┆ 2265.1994 ┆ 4.593013 │\n", "│ ┆ ┆ ┆ 657 ┆ ┆ 13243326 ┆ 729 ┆ 63 ┆ │\n", "│ 507 ┆ 14801 ┆ 16213 ┆ 579.01184 ┆ … ┆ 765611980 ┆ -150.5394 ┆ 2082.2810 ┆ -123.6676 │\n", "│ ┆ ┆ ┆ 1 ┆ ┆ 81484775 ┆ 9 ┆ 06 ┆ 94 │\n", "└───────────┴───────────┴──────────┴───────────┴───┴───────────┴───────────┴───────────┴───────────┘\n", "\n", "Infernos: \n", "shape: (3, 13)\n", "┌───────────┬───────────┬──────────┬───────────┬───┬───────────┬───────────┬───────────┬───────────┐\n", "│ entity_id ┆ start_tic ┆ end_tick ┆ thrower_X ┆ … ┆ thrower_s ┆ X ┆ Y ┆ Z │\n", "│ --- ┆ k ┆ --- ┆ --- ┆ ┆ teamid ┆ --- ┆ --- ┆ --- │\n", "│ i64 ┆ --- ┆ i64 ┆ f64 ┆ ┆ --- ┆ f64 ┆ f64 ┆ f64 │\n", "│ ┆ i64 ┆ ┆ ┆ ┆ str ┆ ┆ ┆ │\n", "╞═══════════╪═══════════╪══════════╪═══════════╪═══╪═══════════╪═══════════╪═══════════╪═══════════╡\n", "│ 371 ┆ 12801 ┆ 13250 ┆ -1513.689 ┆ … ┆ 765611980 ┆ -1101.931 ┆ 2602.0991 ┆ 60.730347 │\n", "│ ┆ ┆ ┆ 087 ┆ ┆ 81484775 ┆ 763 ┆ 21 ┆ │\n", "│ 488 ┆ 15122 ┆ 15437 ┆ -1517.362 ┆ … ┆ 765611989 ┆ -1993.518 ┆ 1637.2847 ┆ 33.104042 │\n", "│ ┆ ┆ ┆ 061 ┆ ┆ 95880877 ┆ 311 ┆ 9 ┆ │\n", "│ 487 ┆ 15132 ┆ 15485 ┆ 1254.0328 ┆ … ┆ 765611990 ┆ 534.49383 ┆ 661.59167 ┆ 18.419727 │\n", "│ ┆ ┆ ┆ 37 ┆ ┆ 63238565 ┆ 5 ┆ 5 ┆ │\n", "└───────────┴───────────┴──────────┴───────────┴───┴───────────┴───────────┴───────────┴───────────┘\n", "\n", "Grenades: \n", "shape: (3, 9)\n", "┌──────────────┬─────────┬─────────────┬──────┬───┬────────────┬───────────┬───────────┬───────────┐\n", "│ thrower_stea ┆ thrower ┆ grenade_typ ┆ tick ┆ … ┆ Y ┆ Z ┆ entity_id ┆ round_num │\n", "│ mid ┆ --- ┆ e ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n", "│ --- ┆ str ┆ --- ┆ i32 ┆ ┆ f32 ┆ f32 ┆ i32 ┆ u32 │\n", "│ u64 ┆ ┆ str ┆ ┆ ┆ ┆ ┆ ┆ │\n", "╞══════════════╪═════════╪═════════════╪══════╪═══╪════════════╪═══════════╪═══════════╪═══════════╡\n", "│ 765611980132 ┆ Aleksib ┆ flashbang ┆ 8238 ┆ … ┆ -393.78125 ┆ 100.84375 ┆ 445 ┆ 1 │\n", "│ 43326 ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n", "│ 765611980132 ┆ Aleksib ┆ flashbang ┆ 8239 ┆ … ┆ -384.03125 ┆ 107.90625 ┆ 445 ┆ 1 │\n", "│ 43326 ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n", "│ 765611980132 ┆ Aleksib ┆ flashbang ┆ 8240 ┆ … ┆ -374.3125 ┆ 114.90625 ┆ 445 ┆ 1 │\n", "│ 43326 ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n", "└──────────────┴─────────┴─────────────┴──────┴───┴────────────┴───────────┴───────────┴───────────┘\n", "\n", "Footsteps: \n", "shape: (3, 11)\n", "┌──────────┬────────┬───────┬──────┬───┬───────────────┬──────────────┬─────────────┬──────────────┐\n", "│ duration ┆ radius ┆ step ┆ tick ┆ … ┆ player_health ┆ player_last_ ┆ player_name ┆ player_steam │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ place_name ┆ --- ┆ id │\n", "│ f32 ┆ i32 ┆ bool ┆ i32 ┆ ┆ i32 ┆ --- ┆ str ┆ --- │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ str ┆ ┆ str │\n", "╞══════════╪════════╪═══════╪══════╪═══╪═══════════════╪══════════════╪═════════════╪══════════════╡\n", "│ 0.5 ┆ 1100 ┆ true ┆ 4 ┆ … ┆ 100 ┆ MidDoors ┆ zont1x ┆ 765611989958 │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ 80877 │\n", "│ 0.1 ┆ 597 ┆ false ┆ 15 ┆ … ┆ 100 ┆ MidDoors ┆ zont1x ┆ 765611989958 │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ 80877 │\n", "│ 0.5 ┆ 1100 ┆ true ┆ 16 ┆ … ┆ 100 ┆ UnderA ┆ chopper ┆ 765611980458 │\n", "│ ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ 98864 │\n", "└──────────┴────────┴───────┴──────┴───┴───────────────┴──────────────┴─────────────┴──────────────┘\n", "\n", "Ticks: \n", "shape: (3, 4)\n", "┌──────┬───────────────────┬───────────┬───────────┐\n", "│ tick ┆ steamid ┆ name ┆ round_num │\n", "│ --- ┆ --- ┆ --- ┆ --- │\n", "│ i32 ┆ u64 ┆ str ┆ u32 │\n", "╞══════╪═══════════════════╪═══════════╪═══════════╡\n", "│ 577 ┆ 76561198386265483 ┆ donk ┆ 1 │\n", "│ 577 ┆ 76561199063238565 ┆ magixx ┆ 1 │\n", "│ 577 ┆ 76561199063068840 ┆ w0nderful ┆ 1 │\n", "└──────┴───────────────────┴───────────┴───────────┘\n" ] } ], "source": [ "from awpy import Demo\n", "\n", "# Demo: https://www.hltv.org/matches/2372746/spirit-vs-natus-vincere-blast-premier-spring-final-2024 (de_dust2, Map 2)\n", "dem = Demo(\"spirit-vs-natus-vincere-m2-dust2.dem\", verbose=True)\n", "dem.parse()\n", "\n", "# Available properties (all demos)\n", "print(f\"\\nHeader: \\n{dem.header}\")\n", "print(f\"\\nRounds: \\n{dem.rounds.head(n=3)}\")\n", "print(f\"\\nKills: \\n{dem.kills.head(n=3)}\")\n", "print(f\"\\nDamages: \\n{dem.damages.head(n=3)}\")\n", "print(f\"\\nWeapon Fires: \\n{dem.shots.head(n=3)}\")\n", "print(f\"\\nBomb: \\n{dem.bomb.head(n=3)}\")\n", "print(f\"\\nSmokes: \\n{dem.smokes.head(n=3)}\")\n", "print(f\"\\nInfernos: \\n{dem.infernos.head(n=3)}\")\n", "print(f\"\\nGrenades: \\n{dem.grenades.head(n=3)}\")\n", "print(f\"\\nFootsteps: \\n{dem.footsteps.head(n=3)}\")\n", "print(f\"\\nTicks: \\n{dem.ticks.head(n=3)}\")\n", "\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Getting player and global properties\n", "Awpy uses [demoparser2](https://github.com/LaihoE/demoparser) as its parsing backend. This means that you can pass a list of `player_props` or `other_props`. In the following example, we get some player position properties. If you do not pass any props, we choose a default list of properties (which is already quite extensive). To see a list of available properties, visit demoparser2's repository." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\u001b[32m2025-02-17 11:27:58.733\u001b[0m | \u001b[34m\u001b[1mDEBUG \u001b[0m | \u001b[36mawpy.demo\u001b[0m:\u001b[36mparse\u001b[0m:\u001b[36m214\u001b[0m - \u001b[34m\u001b[1mStarting to parse spirit-vs-natus-vincere-m2-dust2.dem\u001b[0m\n", "\u001b[32m2025-02-17 11:28:09.006\u001b[0m | \u001b[32m\u001b[1mSUCCESS \u001b[0m | \u001b[36mawpy.demo\u001b[0m:\u001b[36mparse\u001b[0m:\u001b[36m258\u001b[0m - \u001b[32m\u001b[1mFinished parsing spirit-vs-natus-vincere-m2-dust2.dem, took 10.27 seconds\u001b[0m\n", "\n", "Ticks: \n", "shape: (3, 12)\n", "┌─────────────┬────────┬─────────────┬────────────┬───┬──────┬─────────────┬───────────┬───────────┐\n", "│ inventory ┆ health ┆ has_defuser ┆ has_helmet ┆ … ┆ tick ┆ steamid ┆ name ┆ round_num │\n", "│ --- ┆ --- ┆ --- ┆ --- ┆ ┆ --- ┆ --- ┆ --- ┆ --- │\n", "│ list[str] ┆ i32 ┆ bool ┆ bool ┆ ┆ i32 ┆ u64 ┆ str ┆ u32 │\n", "╞═════════════╪════════╪═════════════╪════════════╪═══╪══════╪═════════════╪═══════════╪═══════════╡\n", "│ [\"knife_but ┆ 100 ┆ false ┆ false ┆ … ┆ 577 ┆ 76561198386 ┆ donk ┆ 1 │\n", "│ terfly\", ┆ ┆ ┆ ┆ ┆ ┆ 265483 ┆ ┆ │\n", "│ \"USP-S\"] ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n", "│ [\"knife_kar ┆ 100 ┆ false ┆ false ┆ … ┆ 577 ┆ 76561199063 ┆ magixx ┆ 1 │\n", "│ ambit\", ┆ ┆ ┆ ┆ ┆ ┆ 238565 ┆ ┆ │\n", "│ \"USP-S\"] ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n", "│ [\"knife_m9_ ┆ 100 ┆ false ┆ false ┆ … ┆ 577 ┆ 76561199063 ┆ w0nderful ┆ 1 │\n", "│ bayonet\", ┆ ┆ ┆ ┆ ┆ ┆ 068840 ┆ ┆ │\n", "│ \"Glock-18… ┆ ┆ ┆ ┆ ┆ ┆ ┆ ┆ │\n", "└─────────────┴────────┴─────────────┴────────────┴───┴──────┴─────────────┴───────────┴───────────┘\n" ] } ], "source": [ "dem = Demo(\"spirit-vs-natus-vincere-m2-dust2.dem\")\n", "dem.parse(player_props=[\"X\", \"Y\", \"Z\", \"health\", \"armor_value\", \"has_helmet\", \"has_defuser\", \"inventory\"])\n", "\n", "print(f\"\\nTicks: \\n{dem.ticks.head(n=3)}\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Obtaining all events\n", "Because we use the demoparser2 backend, we can parse many kinds of events in the demo. To see the default list, you can check `Demo.default_events`. These events are parsed unless specified otherwise (via the `events=[...]` argument in `.parse()`). To access parsed events, after parsing a demo, simply check the `.events` property, which is a dictionary where the key is the event name and the value is the parsed Polars dataframe." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "bomb_planted: 12 rows x 13 columns\n", "player_given_c4: 24 rows x 12 columns\n", "bomb_dropped: 63 rows x 13 columns\n", "round_freeze_end: 23 rows x 2 columns\n", "bomb_defused: 2 rows x 13 columns\n", "player_spawn: 242 rows x 12 columns\n", "inferno_startburn: 108 rows x 16 columns\n", "smokegrenade_expired: 135 rows x 16 columns\n", "player_death: 165 rows x 53 columns\n", "weapon_fire: 3402 rows x 14 columns\n", "bomb_pickup: 75 rows x 12 columns\n", "player_sound: 23783 rows x 15 columns\n", "inferno_expire: 108 rows x 16 columns\n", "bomb_exploded: 6 rows x 13 columns\n", "smokegrenade_detonate: 146 rows x 16 columns\n", "round_end: 22 rows x 5 columns\n", "item_pickup: 1724 rows x 15 columns\n", "player_hurt: 588 rows x 29 columns\n", "round_start: 24 rows x 3 columns\n", "hegrenade_detonate: 64 rows x 16 columns\n", "round_officially_ended: 44 rows x 2 columns\n", "flashbang_detonate: 183 rows x 16 columns\n" ] } ], "source": [ "for event_name, event in dem.events.items():\n", " print(f\"{event_name}: {event.shape[0]} rows x {event.shape[1]} columns\")" ] } ], "metadata": { "kernelspec": { "display_name": "3.11.8", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.8" } }, "nbformat": 4, "nbformat_minor": 2 }