Week1 UNQ_C3 KeyError

Good morning,
maybe I’m having a stupid issue but I can’t understand the function “extract_features”. I’m getting this error

That is reasonable since there is no tuple (‘followfriday’, 0.0) in the freqs dictionary, so I do not understand what kind of indexing error I’m doing.

Thank you very much for your help

Hi, Nicola.

When you get KeyError with Python dictionaries what it means is that this dictionary does not have the key you’re asking for. So Python dictionaries have .get() method that might help you achieve what you want - you can provide default value to return when the dictionary does not have the key.


Well, maybe I’d better revise python basics :sweat_smile:

Thank you very much!