Skip to main content

Installation

To get the latest version of the code, clone the repository, and use poetry install to install the dependencies.

You can also install the package into a conda environment using the following command

conda activate py38
pip install .

This will install the package into the py38 environment.

Examples

The subsections below list examples for loading various kinds of budget-related data sets for the City of Philadelphia.

Revenue Reports

Data is available from the City of Philadelphia's Revenue reports, as published to the City's website.

City Collections

Monthly PDF reports are available on the City of Philadelphia's website according to fiscal year (example: FY 2021).

Note: Cleaned CSV files are available in the following folder: src/phl_budget_data/data/processed/collections/monthly/city/

Load the data using Python:

from phl_budget_data.clean import load_city_collections

data = load_city_collections()
data.head()

Output:

                        name  fiscal_year        total month_name  month  fiscal_month  year       date kind
0                      sales         2021   14228731.0        jan      1             7  2021 2021-01-01  Tax
1  wage_earnings_net_profits         2021  182689530.0        jan      1             7  2021 2021-01-01  Tax
2                       soda         2021    5149478.0        jan      1             7  2021 2021-01-01  Tax
3                outdoor_ads         2021     179166.0        jan      1             7  2021 2021-01-01  Tax
4       real_estate_transfer         2021   27222198.0        jan      1             7  2021 2021-01-01  Tax

School District Collections

Monthly PDF reports are available on the City of Philadelphia's website according to fiscal year (example: FY 2021).

Note: Cleaned CSV files are available in the following folder: src/phl_budget_data/data/processed/collections/monthly/school/

Load the data using Python:

from phl_budget_data.clean import load_school_collections

data = load_school_collections()
data.head()

Output:

                name  fiscal_year     total month_name  month  fiscal_month  year       date
0        real_estate         2021  50817991        jan      1             7  2021 2021-01-01
1      school_income         2021    436599        jan      1             7  2021 2021-01-01
2  use_and_occupancy         2021  19395530        jan      1             7  2021 2021-01-01
3             liquor         2021   1874302        jan      1             7  2021 2021-01-01
4       other_nontax         2021      2000        jan      1             7  2021 2021-01-01

Monthly Wage Tax Collections by Industry

Monthly PDF reports are available on the City of Philadelphia's website according to calendar year (example: 2020).

Note: Cleaned CSV files are available in the following folder: src/phl_budget_data/data/processed/collections/by-sector/wage/

Load the data using Python:

from phl_budget_data.clean import load_wage_collections_by_sector

data = load_wage_collections_by_sector()
data.head()

Output:

                                              sector               parent_sector      total month_name  month  fiscal_month  year  fiscal_year       date
0                              Unclassified Accounts                         NaN   494978.0        jan      1             7  2021         2021 2021-01-01
1                                    Wholesale Trade                         NaN  4497890.0        jan      1             7  2021         2021 2021-01-01
2                 Nursing & Personal Care Facilities  Health and Social Services  3634459.0        jan      1             7  2021         2021 2021-01-01
3  Outpatient Care Centers and Other Health Services  Health and Social Services  6267932.0        jan      1             7  2021         2021 2021-01-01
4  Doctors, Dentists, and Other Health Practitioners  Health and Social Services  5392573.0        jan      1             7  2021         2021 2021-01-01

Quarterly City Manager's Report

PDF reports are available on the City of Philadelphia's website here.

Cash Report

Load the data using Python:

from phl_budget_data.clean import load_qcmr_cash_reports

revenue = load_qcmr_cash_reports(kind="revenue")
revenue.head()

Output:

                      category  fiscal_month  amount  fiscal_year  quarter  month
0              Real Estate Tax             1     9.1         2021        4      7
1  Wage, Earnings, Net Profits             1   134.1         2021        4      7
2          Realty Transfer Tax             1    36.4         2021        4      7
3                    Sales Tax             1    24.4         2021        4      7
4                         BIRT             1   266.4         2021        4      7

Data can be load by specifying kind as "revenue", "spending", "fund-balances", or "net-cash-flow".

Adding the Latest Data

This section describes how to add the latest processed data files to the repository.

QCMR Cash Reports

  1. Add the two-page PDF for the cash report to the src/phl_budget_data/data/raw/qcmr/cash folder
  2. Run the following command to convert the PDF to a processed CSV:

For example, for FY21 Q4:

poetry shell
phl-budget-etl qcmr cash --fiscal-year 2021 --quarter 4
  1. Now, add the new CSV files to git, and push the changes to GitHub:

From the root folder:

git add .
git commit -m "Add new QCMR cash report"
git push origin main

Metadata

Release files for phl-budget-data 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phl-budget-data 0.2.1
File Size Uploaded
phl-budget-data-0.2.1.tar.gz 566.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phl-budget-data 0.2.1
File Interpreter ABI Platform
phl_budget_data-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.2 MB

Release files / phl-budget-data-0.2.1.tar.gz

Download URL phl-budget-data-0.2.1.tar.gz
Size 566.0 kB
Tags Source
SHA-256 checksum
How to use checksums
79a2e9c93206b48d7d5251b337446f1bb5688756d3ebcf7d981764c809a912bc
BLAKE2b-256 checksum
How to use checksums
fd16adf0696149dc09fdcbbce6412c2f2b361e59f570f017e305f9612fc32fcf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.7 Darwin/20.6.0

Release files / phl_budget_data-0.2.1-py3-none-any.whl

Download URL phl_budget_data-0.2.1-py3-none-any.whl
Size 600.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
545dd03974da42935620d5386e6ed31b4fe384ed359aad8d4494b13648fed34e
BLAKE2b-256 checksum
How to use checksums
a5ebf15d713830a1ef5fb1f82fc8369d82b560411aaf990399ed5c5a83efd997
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.9.7 Darwin/20.6.0

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page