OpenSourcePolicyCenter/taxcalc — pull request #17 by Copper-Head (2014-08-31 20:04:43+00:00)
Title: Making things "pythonic"

This is a biggish update from me (mostly addressing #10 and #11) and I would like to discuss a couple of things in it **before** you merge my changes into the master branch. Treat this not just as a finished product, but as a work in progress. Please do take advantage of commenting on specific lines (git lets you do that, hurrah!), I'm looking forward to your feedback.
I've worked on the following stuff:

1. PUF file is read from a pickled binary file which is much much faster than using Pandas. What is read in is already a dictionary where every variable is a key and its PUF np.array column is the value. While generating the pickle file I saved the len() of the pandas DataFrame which came from puf.csv under the key 'PUF DIM'. This then gets used by Sameer's PUF() function to set the vars we're missing to arrays of zeros with the right length (same as other PUF vars). This length is also used in a couple of other functions and I'd like to talk about those in more detail, see my comments to (and in!) the source code below.

2. Plan X and (optionally!) Plan Y can now be read in as JSON files. I've created a version of the Plan X JSON and will have to show it to Dan to finalize, but it's a copy of all the variables being defined in Sameer's code and the script runs fine with it, so I presume I haven't broken anything and we're fine.

3. Some "pythony" things (based on documentation and [this](http://legacy.python.org/dev/peps/pep-0008/)):
* all tabs have been replaced with spaces (1 tab char = 4 space chars)
* I've started removing underscores from variable names, but would like to finish that before we merge
* Python doesn't require one to preallocate memory for an array, so I removed some np.zeros() calls, but would like to chat more about that with @SameerSarkar