Created
June 25, 2020 00:17
-
-
Save rob-luke/8576ad802f5b1481b94ebb5f5979cdb9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def summarise_triggers(raw): | |
import pandas as pd | |
df = pd.DataFrame() | |
for desc in np.unique(raw.annotations.description): | |
picks_desc = [d == desc for d in raw.annotations.description] | |
try: | |
# Handle triggers when they are still in numbers | |
desc = float(desc) | |
except: | |
# Handle triggers that have been converted to strings | |
desc = desc | |
df = df.append({'Trigger': desc, | |
'Occurances': np.sum(picks_desc)}, | |
ignore_index=True) | |
return df.sort_values('Trigger') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment