A python library for making Excel files from FEC filings
Project description
Microsoft Excel can be a powerful tool for analyzing FEC filings. This library (hopefully) makes it easy to create multi-sheet Excel files from files in the .fec file format, with a sheet for the summary data and a sheet for each type of itemization.
Usage
Note: this library works best with version 3.7+ of Python due to the ordering of dictionary keys being guaranteed to be in insertion order. The library should still work in older version of Python, but the columns on each sheet might be in a nonsensical order.
First, install from PyPi:
pip install fec2xlsx
Then, call one of the two methods for generating Excel files:
import fec2xlsx
fec2xlsx.file_number_xlsx(1326061, 'Gillibrand_Q1.xlsx')
fec2xlsx.file_location_xlsx('/path/to/1326016.fec', 'Harris_Q1.xlsx')
The file_number_xlsx method requests the specified file_number via http from the FEC's server's, first trying the URL for digital filings, then trying the URL for paper filings if the first response returns a 404 status code.
The file_location_xlsx method reads from the specified file_path (which takes anything you might pass to Python's open method) then writes to the specified filename output.
Both methods take an optional options keyword argument.
Options
-
filter_memo_x: (default:True) if True, ignores rows that have "X" as theirmemo_code. If, for example, a contribution comes in through a conduit committee like ActBlue, there are two rows: one for the contribution from an individual to the conduit and one from the conduit to the committee filing the report. Generally the second of those rows is marked with an "X" in thememo_codefield and is the less useful of the two. -
money_format: (default:$#,##0.00) The format used for displaying monetary values. See here for more details/documentation. -
date_format: (default:d mmm yyyy) The format used for displaying date values. See here for more details/documentation.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fec2xlsx-0.1.2.tar.gz.
File metadata
- Download URL: fec2xlsx-0.1.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1096273278acd16c7ca442e82cf5d129c03b4be89c95ad7182baea4d0c74886d
|
|
| MD5 |
03df434beee2cfd2b8faf819dddf2e3f
|
|
| BLAKE2b-256 |
ec11c0191a09839acbfbcbaeac2b9f1cdf548e39e745bd6220b390f2e41173d3
|
File details
Details for the file fec2xlsx-0.1.2-py3-none-any.whl.
File metadata
- Download URL: fec2xlsx-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8d79555c08dec9b491ce7d6109f4a3b8188ff51ae12ad9f76a79c8403713ded
|
|
| MD5 |
cdad7e991a5e9a47d2da585deb26d033
|
|
| BLAKE2b-256 |
af62345462e9028375813f998c723fe152189a0548c4e869913869282eb7362c
|