How Can I Access IPUMS .CSV Data Using Python?

Hello. I’ve been trying to access an IPUMS (.CSV) data using Python, but it’s not letting me. I would like to view the first 1000 rows of data and all columns (independent variables).

So far, I have this:

import readers

import pandas as pd

import requests

print(“Pandas version:”, pd.version) print(“Requests version:”, requests.version)

ddi = readers.read_ipums_ddi(r”C:UsersjennyDownloadsusa_00003.xml”) ipums_df = readers.read_microdata(ddi, r”C:UsersjennyDownloadsusa_00003.csv.gz”)

iter_microdata = readers.read_microdata_chunked(ddi, chunksize=1000)

df = next(iter_microdata)

What am I doing wrong?

submitted by /u/jenny-0515
[link] [comments]

Leave a Reply

Your email address will not be published. Required fields are marked *