How to sub-set a Dictionary

User 3060 | 1/18/2016, 4:41:32 PM

Is there a way to subset a dictionary. Eg if we create a 1-gram or TF-IDF it adds a dictionary to each row. Is there a way to subset or filter items of this dictionary eg all items above or below a threshold value?

Comments

User 1189 | 1/25/2016, 6:19:46 PM

gl.SArray.dicttrimby_values

For instance, if you have an SFrame with a column "ngram" for instance. you can go sf['ngram'] = sf['ngram'].dict_trim_by_values(lower=1,upper=5)

To only retain all keys with values between 1 and 5 inclusive.