Skip to content

Install & Run

Catherine Birney edited this page Sep 11, 2023 · 14 revisions

Prerequisites

  1. Python 3.9 or greater, 64-bit version - https://www.python.org/downloads/
  2. The latest version of pip. Included as a default option with Python installation.

Installation of python module

From command line, run:

pip install git+https://github.com/USEPA/flowsa#egg=flowsa

Or to install a specific version, run

pip install git+https://github.com/USEPA/[email protected]#egg=flowsa

where 'vX.X.X' is the version you wish to use under Releases.

You can test the installation by opening a Python console and entering

import flowsa

If no error is returned, the libraries are installed.

Example Code

Example code is found in the examples folder.

Reading Parquet Files

FlowByActivity.py and FlowBySector.py generate parquet files. In python, use pandas to read the parquet file and save in another format.

Example to save as a csv:

import pandas
# load the parquet
df = pd.read_parquet(file_name)
# maintain leading 0s in location col
df.Location = df.Location.apply('="{}"'.format)
# save output to csv with a user defined output_path
df.to_csv(output_path + '_' + file_name + ".csv", index=False)


See this stackoverflow post for a discussion on GUI tools for viewing parquets.