milkietx / ipums-helper Goto Github PK
View Code? Open in Web Editor NEWThis project forked from ameasure/ipums-helper
Python library that automatically parses IPUMS (Integrated Public Use Microdata Series) datasets.
This project forked from ameasure/ipums-helper
Python library that automatically parses IPUMS (Integrated Public Use Microdata Series) datasets.
Purpose: To provide a simple function that maps the raw IPUMS data extract to the variable values it represents. For example, the first few lines of an IPUMS data file might look like the following: 2008010000008200082000 2008010000002300066000 2008010000008800070021 2008010000006600070000 2008010000006600069000 Here, each line represents a single survey respondent. The first four characters of the line are the YEAR variable, the next two are the STATEFIP variable, the next 10 are the PERWT, etc. The row_generator() function uses the IPUMS data file and the DDI xml file that accompanies it to automatically parse each line of the data file into a dictionary with each key representing the variable value. Usage: Step 1: Download the IPUMS dat file (ie, "usa_00001.dat") and the corresponding DDI file (for example, "usa_00001.xml") from the IPUMS website. Step 2: Import the row_generator function from the ipums_lib function Step 3: Create a row_generator, supplying the paths to the IPUMS dat file and the corresponding DDI file. Example Usage: >>> from ipums_lib import row_generator >>> >>> rows = row_generator(datapath = "usa_00001.dat", ddipath = "usa_00001.xml") >>> for row in rows: >>> print row {u'STATEFIP': '01', u'PERWT': '00000082.00', u'AGE': '082', u'MIGPLAC1': '000', u'YEAR': '2008'} {u'STATEFIP': '01', u'PERWT': '00000023.00', u'AGE': '066', u'MIGPLAC1': '000', u'YEAR': '2008'} {u'STATEFIP': '01', u'PERWT': '00000088.00', u'AGE': '070', u'MIGPLAC1': '021', u'YEAR': '2008'} {u'STATEFIP': '01', u'PERWT': '00000066.00', u'AGE': '070', u'MIGPLAC1': '000', u'YEAR': '2008'} {u'STATEFIP': '01', u'PERWT': '00000066.00', u'AGE': '069', u'MIGPLAC1': '000', u'YEAR': '2008'}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.