pytoolz / pytoolz/toolz

Consider adding a `zipdict()` function

Open
#291 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
5.2k
Forks
280
Avg merge
6d 17h
Merged PRs (30d)
4

Description

Please consider adding a zipdict() function that mimics the zip() function but on dictionaries This utility allows to iterate the items (key,value) of a list of dictionaries based on their common keys.

The necessity for such a function is described in this SO question: http://stackoverflow.com/questions/16458340/python-equivalent-of-zip-for-dictionaries

A starting implementation would be based on @Volatilty's suggestion in the above question:

def zipdict(*dcts):
    if dcts:
        for k in set(dcts[0]).intersection(*dcts[1:]):
            yield k, tuple(d[k] for d in dcts)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue names no repository files, entry points, or tests; start with the proposed implementation and the linked Stack Overflow question. Check the project's conventions for adding public utilities and tests, then confirm behavior for common keys and multiple dictionaries. Done means the function is integrated, tested, and its expected behavior is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.