https://github.com/pnxenopoulos/awpy
Python library to parse, analyze and visualize Counter-Strike 2 data
https://github.com/pnxenopoulos/awpy
counter-strike counter-strike-global-offensive csgo esports python sports-analytics sports-data
Last synced: 2 months ago
JSON representation
Python library to parse, analyze and visualize Counter-Strike 2 data
- Host: GitHub
- URL: https://github.com/pnxenopoulos/awpy
- Owner: pnxenopoulos
- License: mit
- Created: 2020-01-06T19:18:48.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T03:43:01.000Z (10 months ago)
- Last Synced: 2024-11-08T18:54:05.943Z (8 months ago)
- Topics: counter-strike, counter-strike-global-offensive, csgo, esports, python, sports-analytics, sports-data
- Language: Python
- Homepage: http://www.awpycs.com
- Size: 258 MB
- Stars: 389
- Watchers: 10
- Forks: 58
- Open Issues: 26
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-esports - awpy - A Python library for parsing, analyzing, and visualizing CS:GO data. (Libraries / Data parsing and analysis)
README
Awpy
[](https://discord.gg/W34XjsSs2H) [](https://pepy.tech/project/awpy) [](https://github.com/pnxenopoulos/awpy/actions/workflows/build.yml) [](https://github.com/pnxenopoulos/awpy/actions/workflows/artifacts.yml) [](https://awpy.readthedocs.io/en/latest/?badge=latest) [](https://github.com/pnxenopoulos/awpy/blob/main/LICENSE)
**Counter-Strike 2 Demo Parsing, Analytics and Visualization in Python**
- :computer: Parse Counter-Strike demos in Python or with a command-line interface
- :skull: Access tick-level player and event data, like kills, damages and more
- :chart: Calculate popular statistics, such as ADR, KAST and Rating
- :mag_right: Determine player visibility in microseconds
- :earth_americas: Parse navigation meshes (.nav) and calculate distance metrics
- 🎞️ Visualize Counter-Strike data, including animated round gifs and heatmaps
- :speaker: Active [Discord](https://discord.gg/W34XjsSs2H) community## Installation
To install Awpy, you can run
```
pip install awpy
```> [!NOTE]
> Awpy requires [Python](https://www.python.org/downloads/) >= 3.11. To update the library, just run `pip install --upgrade awpy`. To check your current Awpy version, run `pip show awpy`. If you want to see what data is available for download, run `awpy get --help`.> [!TIP]
> Don't worry if you get stuck, visit [our Discord](https://discord.gg/W34XjsSs2H) for help.## Example Code
Using Awpy is easy. Just find a demo you want to analyze and use the example below to get started. You can easily find demos on [HLTV](https://hltv.org), [FACEIT](https://faceit.com) or [CS2Stats](https://csstats.gg/).
```python
from awpy import Demo# Create and parse demo
dem = Demo("g2-vs-navi.dem")
dem.parse()# Access various dictionaries & dataframes
dem.header
dem.rounds
dem.grenades
dem.kills
dem.damages
dem.bomb
dem.smokes
dem.infernos
dem.shots
dem.footsteps
dem.ticks# The dataframes are Polars dataframes
# to transform to Pandas, just do .to_pandas()
dem.ticks.to_pandas()
```> [!TIP]
> Want to learn more about the parser output? Visit the [parser primer](https://awpy.readthedocs.io/en/latest/modules/parser_output.html) in our documentation!### Help! The parser doesn't work or returns weird data
Counter-Strike demos can be a bit troublesome. It is likely you'll see increased error rates in POV demos. To help us address parsing issues, please open a bug report in our [Github issues](https://github.com/pnxenopoulos/awpy/issues). Additionally, you can reach out in [our Discord](https://discord.gg/3JrhKYcEKW). We're appreciate any help in identifying bugs. We use [LaihoE's demoparser](https://github.com/LaihoE/demoparser) as a backend, so you may also check there for any open issues.
## Examples and Projects
Take a look at the following Jupyter notebooks provided in our `examples/` directory. These will help you get started parsing and analyzing Counter-Strike data.
- [Parsing a CS2 demofile](https://awpy.readthedocs.io/en/latest/examples/parse_demo.html)
- [Parsing a CS2 demofile through command-line](https://awpy.readthedocs.io/en/latest/examples/parse_demo_cli.html)
- [Calculating ADR, KAST% and Rating](https://awpy.readthedocs.io/en/latest/examples/demo_stats.html)
- [Plotting CS2 demos](https://awpy.readthedocs.io/en/latest/examples/plot_demo.html)
- [Calculating visibility from CS2 demos](https://awpy.readthedocs.io/en/latest/examples/visibility.html)
- [Parsing CS2 `.nav` files](https://awpy.readthedocs.io/en/latest/examples/nav.html)If you use the parser for any public analysis, we kindly ask you to link to the Awpy repository, so that others may know how you parsed, analyzed or visualized your data. If you have a paper or project that uses the parser, please let us know in Discord so we can add it to our growing list!
> [!IMPORTANT]
> If you use Awpy, we'd love if you could link back to our repo!## Contributing
We welcome any contributions from the community, no matter the skill-level. You can visit our [issue page](https://github.com/pnxenopoulos/awpy/issues) to see what issues are still open, the [Awpy project](https://github.com/users/pnxenopoulos/projects/5) for a different view of project priorities, or you can message us on Discord. Some examples of where you can make a difference are in documentation, quality assurance, developing new features, or creating unique content with Awpy. You can see more examples of community content [here](https://awpy.readthedocs.io/en/latest/projects.html). If you are interested in contributing to Awpy, learn more [here](https://github.com/pnxenopoulos/awpy/blob/main/CONTRIBUTING.md).
> [!TIP]
> We are happy to walk through those that want to contribute, no matter your skill level. There are a diverse set of ways one can contribute to Awpy. We welcome first-time contributors!## Acknowledgments
The name "Awpy" is due to [Nick Wan](https://www.twitch.tv/nickwan_datasci) -- we recommend his stream for sports data analytics enthusiasts.
Awpy was first built on the amazing work done in the [demoinfocs-golang](https://github.com/markus-wa/demoinfocs-golang) Golang library. We now rely on [demoparser2](https://github.com/LaihoE/demoparser) for parsing, which is another fantastic parsing project, built specifically for Python.
Awpy's team includes JanEric, adi and hojlund, who you can find in the Awpy Discord. Their work, among others, is crucial to Awpy's continued success! To contribute to Awpy, please visit [CONTRIBUTING](https://github.com/pnxenopoulos/awpy/blob/main/CONTRIBUTING.md).