Created
May 17, 2018 19:25
-
-
Save avremel/c54573d418ca9d809c6fe33542161814 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import more_itertools as mit | |
facets = {} | |
for k,v in raw_response['facet_counts']['facet_fields'].items(): | |
spec_list = [list(spec) for spec in mit.chunked(v, 2)] | |
spec_dict = {} | |
for spec in spec_list: | |
spec_dict[spec[0]] = spec[1] | |
facets[k] = spec_dict | |
raw_response['facet_counts']['facet_fields'] = facets |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment