Calculating Counter-Strike 2 Stats

Awpy can also help calculate basic Counter-Strike statistics, such as average damage per round (ADR), kill-assist-survival-trade (KAST%) or Rating.

[3]:
from awpy import Demo

# Demo: https://www.hltv.org/matches/2372746/spirit-vs-natus-vincere-blast-premier-spring-final-2024 (de_dust2, Map 2)
dem = Demo("spirit-vs-natus-vincere-m2-dust2.dem")
dem.parse()

Average Damage per Round (ADR)

Average Damage per Round (ADR) is a common metric to evaluate Counter-Strike players. It is simply the total damage divided by the number of rounds. We can can calculate ADR in Awpy as follows:

[4]:
from awpy.stats import adr

adr(dem)
[4]:
shape: (30, 6)
namesteamidsiden_roundsdmgadr
stru64stru32i32f64
"w0nderful"76561199063068840"t"1267155.916667
"sh1ro"76561198081484775"ct"12118698.833333
"jL"76561198176878303"ct"1080180.1
"donk"76561198386265483"t"1094694.6
"sh1ro"76561198081484775"t"101059105.9
"jL"76561198176878303"all"22188585.681818
"Aleksib"76561198013243326"all"222232101.454545
"donk"76561198386265483"all"222647120.318182
"chopper"76561198045898864"all"22120854.909091
"zont1x"76561198995880877"all"22171477.909091

ADR takes two optional arguments, team_dmg (default False), which removes team damage from the overall damage calculation, and self_dmg (default True), which removes any damage the player did to themselves. It is advised to leave these defaults as is in order to match most websites.

Kill, Assist, Survival and Trade % (KAST%)

Another common Counter-Strike statistic is KAST%, or the % of rounds where a player achieves a kill, assist, survives or trades. We can calculate KAST% in Awpy as follows:

[5]:
from awpy.stats import kast

kast(dem, trade_length_in_seconds=5)
[5]:
shape: (30, 6)
namesteamidsidekast_roundsn_roundskast
stru64stru32u32f64
"chopper"76561198045898864"all"142263.636364
"donk"76561198386265483"all"182281.818182
"w0nderful"76561199063068840"all"182281.818182
"sh1ro"76561198081484775"all"172277.272727
"jL"76561198176878303"all"152268.181818
"magixx"76561199063238565"t"81080.0
"w0nderful"76561199063068840"t"111291.666667
"jL"76561198176878303"t"91275.0
"zont1x"76561198995880877"t"61060.0
"chopper"76561198045898864"t"61060.0

KAST takes one argument, trade_length_in_seconds, which specifies the length of a trade time in seconds. The default is 5 seconds.

Rating

HLTV developed Rating and Rating 2.0, which are well-described here and an example is reverse-engineered here. We provide a rating-esque statistic in awpy.stats.rating. You can calculate rating in Awpy as follows:

[6]:
from awpy.stats import rating

rating(dem)
[6]:
shape: (30, 6)
namesteamidsiden_roundsimpactrating
stru64stru32f64f64
"chopper"76561198045898864"all"220.5568180.66615
"donk"76561198386265483"all"221.9313641.562747
"jL"76561198176878303"all"221.5263641.231553
"magixx"76561199063238565"all"221.0013641.185146
"sh1ro"76561198081484775"all"221.9122731.587677
"chopper"76561198045898864"t"100.5680.7551796
"jL"76561198176878303"t"121.721.273859
"iM"76561198050250233"t"120.510.51913
"zont1x"76561198995880877"t"100.3970.5996484
"w0nderful"76561199063068840"t"120.54750.7978

You can control the individual coefficients as arguments, via kast_coef=..., kills_coef=... and so on.