feat: Initial commit of Clutch-IQ project
This commit is contained in:
26
tools/debug/debug_bomb.py
Normal file
26
tools/debug/debug_bomb.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from demoparser2 import DemoParser
|
||||
import os
|
||||
import pandas as pd
|
||||
|
||||
demo_path = os.path.join(os.getcwd(), "data", "demos", "furia-vs-falcons-m1-inferno.dem")
|
||||
parser = DemoParser(demo_path)
|
||||
|
||||
print("Listing events related to bomb...")
|
||||
# Check events
|
||||
# parse_events returns a list of tuples or dicts? Or a DataFrame?
|
||||
# The previous error said 'list' object has no attribute 'head', so it returns a list of tuples/dicts?
|
||||
# Wait, usually it returns a DataFrame. Let's check type.
|
||||
events = parser.parse_events(["bomb_planted", "bomb_defused", "bomb_exploded", "round_start", "round_end"])
|
||||
print(f"Type of events: {type(events)}")
|
||||
|
||||
if isinstance(events, list):
|
||||
print(events[:5])
|
||||
# Try to convert to DF
|
||||
try:
|
||||
df = pd.DataFrame(events)
|
||||
print(df.head())
|
||||
print(df['event_name'].value_counts())
|
||||
except:
|
||||
pass
|
||||
else:
|
||||
print(events.head())
|
||||
Reference in New Issue
Block a user