pillargg / pillar_algos

Finds best timestamps to cut at
https://docs.pillar.gg/pillar_algos/
GNU General Public License v3.0
1 stars 0 forks source link

Algo3 fails on KeyError for 'emoticons' #38

Closed gatesyp closed 3 years ago

gatesyp commented 3 years ago

When running the algos for https://www.twitch.tv/videos/1015750167 , algo3 errors out here:

[ERROR] KeyError: 'emoticons'Traceback (most recent call last):  File "/var/task/handler.py", line 33, in handler    algo3 = algo3_0.run(all_messages, min_=.5,  limit=10)  File "/var/task/pillaralgos/algo3_0.py", line 141, in run    results, first_stamp = thalamus(big_df, min_=min_, min_words=min_words, goal="num_top_user_appears")  File "/var/task/pillaralgos/algo3_0.py", line 18, in thalamus    id_words = id_words_counter(big_df)  File "/var/task/pillaralgos/algo3_0.py", line 89, in id_words_counter    emoji = temp_df["emoticons"].apply(lambda x: 0 if type(x) == float else len(x))  File "/var/task/pandas/core/frame.py", line 3024, in __getitem__    indexer = self.columns.get_loc(key)  File "/var/task/pandas/core/indexes/base.py", line 3082, in get_loc    raise KeyError(key) from err
--
pomkos commented 3 years ago

Try except didn't work for whatever reason, it didn't catch the error when Code compiled to lib but it does work if script directly imported.

Gonna check switch to if else instead

gatesyp commented 3 years ago

cool

saw this when i was googling before doing the try except:

https://stackoverflow.com/questions/24870306/how-to-check-if-a-column-exists-in-pandas