0

I'm trying to read the FEC's "contributions by individuals" (indiv18.zip), (available here: https://classic.fec.gov/finance/disclosure/ftpdet.shtml#a2017_2018) into python. It comes downloaded into several .txt files. I'm very new and I'm confused how I can read these files into python. Thanks so much!

1 Answer 1

1

Download the file first,then unzip it

Try this code

import pandas as pd

with open("cm.txt", "r", newline="") as f:
    table = pd.read_table(f, sep='|',lineterminator='\n')

print (table[:0])

Output

Empty DataFrame
Columns: [C00000018, IRONWORKERS LOCAL UNION NO. 25 POLITICAL EDUCATION COMMITTEE, STEVEN N GULICK, 43335 W 10 MILE, P O BOX 965, NOVI, MI, 48050, U, Q, Unnamed: 10, T, Unnamed: 12, IRON WORKERS; INT'L ASS'N OF BRIDGE..., H8TX22313]
Index: []

Read about pandas.read_table

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.