Writing production grade pandas with hamilton!
While Pandas is incredibly flexible and easy to get started with, it doesn't lend itself to writing good quality, extensible code. This is usually fine. Lots of it is thrown away -- written in notebooks and never seen again. However, a  lot amount of it ends up making it into production ETLs, services, etc..

At Stitch Fix, we had a *lot* of monolithic, messy pandas scripts. We built [hamilton](https://github.com/stitchfix/hamilton/) to solve this problem. A programmer represents transforms on dataframes as a series of python functions. The parameter names are used to specify upstream dependencies, and the whole thing gets wired into a dependency graph.

In short -- instead of writing:

    df['a'] = df['b'] + df['c']

You'd write:

    def a(b: pd.Series, c: pd.Series) -&gt; pd.Series:
        return b+c

Then you use a *driver* to customize execution, pass in paraemeters, etc... Note that its not at all limited to pandas -- while that was the initial use-case, it can handle any sort of python datatype!

We've opened up this internal tool we're excited about to the outside world -- we'd love feedback, contribution, and use-cases!

[https://github.com/stitchfix/hamilton/](https://github.com/stitchfix/hamilton/)