-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attackerSteamIDs in DF['damages'] rounding error if there is any World or C4 damage done #213
Comments
@Siiggyy i got the same probem here OwO |
What exactly is the output you are getting vs the output you are expecting.
But that seems like more than a rounding error. For example I dont think a manual check on this it the way to go as |
I think i got a fix that solves this problem.
but if i change awpy/awpy/parser/demoparser.py Line 600 in ccd9c34
return pd.DataFrame(damages, dtype=object) i get
so now it doesnt do any weird conversions. however the dtypes of all the columns is now |
I dug a bit deeper and its seems that this is a known issue with pandas. It is actually using the correct nullable integer type but there is a casting to float going on behind the scene that causes this issue. See pandas-dev/pandas#26259 and pandas-dev/pandas#32134 for examples. It seems the issued were fixed literally 2 days ago in a MR pandas-dev/pandas#50757. Sadly version 1.5.3 was released exactly a day before. So this issue will probably get fixed in the next pandas release which we should then upgrade to. So we should probably decide on what the best workaround is until then. |
We could see a new pandas release probably in anywhere from 1-3 months from now. To address this issue, we could enforce a steamid of 0, like @Siiggyy does. I believe I might have done this before. Another option is to actually assign a steamid through some logic. For example, world damage could go to attacker and C4 damage to the bomb planter (not really sure I like this, though, plus, I don't know what causes world damage). How about for awpy 1.2.3 we change the golang code to return an attacker steamid of 0 in world/c4 damages? |
I wouldn't change the damage to go to the attacker or bomb planter since that would probably screw with a lot of statistics. My guess would be world damage is like falling of a building, maybe falldamage. |
I also wouldn't try to assign these DMG events to someone. And I also think it is fine to have no attacker steamid when the DMG is not from a character. I think bots get steamid 0 and that change would make it harder to differentiate. I feel we should manually set it to 0 for now until there is a new pandas version that includes a fix. At tust point I think we should switch back to the current syntax. @Siiggyy would just have to be aware that he can't relay on the steamid always being an int then. |
You could also take another placeholder if bots get steamid 0. And it would be fine if it won't be an int as long as the id is correct in the end then i could still convert it afterwards. |
I think for a temporary placeholder it should be fine as 0 even with the collision with the bots. although -1 (does that work?) or 1 would also be fine and maybe better. I was just referring to xenos idea to adjust it in awpy in general. I think the ideal state would be the current one without pandas bugging out. |
Similar bug happens with the Kills df my guess currently is it happens if a player disconnects while he is alive since it counts as a death (suicide and teamkill) but attacker SteamID is NaN. And with that we get the same conversion error again. Temporary fix: for k in r["kills"]: |
Pandas 2.0 is out: Could you check that this now works without issue? In that case we can just update the requirements. |
Might need a small change to use arrow types there:
From here: https://www.reddit.com/r/Python/comments/12b7w3y/everything_you_need_to_know_about_pandas_200/ |
If you create a DataFrame with parse_json_to_df the df['damages'] sometimes has a rounding error in the attackerSteamID if there is any damage done through world or C4, since the attackerSteamID for those is of Type None. And if you then create the DF from that the Steamids get messed up.
Issue happens on line 594 in file demoparser.py a fix could be to give world a custom attackerSteamID.
awpy/awpy/parser/demoparser.py
Line 594 in ccd9c34
I currently have it implemented that way World or C4 damage get the attackerSteamID 0.
Added my JSON for testing purposes.
JSON.zip
The text was updated successfully, but these errors were encountered: