Skip to content

Instantly share code, notes, and snippets.

@gschivley
Created March 20, 2019 02:15
Show Gist options
  • Save gschivley/d4d6ffd6789796a9cb68ea3fe9909107 to your computer and use it in GitHub Desktop.
Save gschivley/d4d6ffd6789796a9cb68ea3fe9909107 to your computer and use it in GitHub Desktop.
"""
Short script for loading/merging EIA860 generator, utility, and plant info.
Assumes that files are in the same folder as this script.
"""
import pandas as pd
util_fn = '1___Utility_Y2017.xlsx'
utility = pd.read_excel(util_fn, header=1, na_values=[' '])
plant_fn = '2___Plant_Y2017.xlsx'
plant = pd.read_excel(path, header=1, na_values=[' '])
path = '3_1_Generator_Y2017.xlsx'
gen = pd.read_excel(path, header=1, na_values=['.'], skipfooter=1)
util_cols = ['Utility ID', 'Entity Type']
util_gen = pd.merge(utility[util_cols], gen, on='Utility ID')
plant_cols=[
'Plant Code', 'NERC Region', 'Balancing Authority Code',
'Balancing Authority Name', 'Name of Water Source',
'Primary Purpose (NAICS Code)', 'Regulatory Status', 'Sector',
'Sector Name', 'FERC Cogeneration Status',
'FERC Cogeneration Docket Number', 'FERC Small Power Producer Status',
'FERC Small Power Producer Docket Number',
'FERC Exempt Wholesale Generator Status',
'FERC Exempt Wholesale Generator Docket Number', 'Ash Impoundment?',
'Ash Impoundment Lined?', 'Ash Impoundment Status',
'Transmission or Distribution System Owner',
'Transmission or Distribution System Owner ID',
'Transmission or Distribution System Owner State', 'Grid Voltage (kV)',
'Grid Voltage 2 (kV)', 'Grid Voltage 3 (kV)', 'Energy Storage',
'Natural Gas LDC Name', 'Natural Gas Pipeline Name 1',
'Natural Gas Pipeline Name 2', 'Natural Gas Pipeline Name 3',
'Pipeline Notes', 'Natural Gas Storage',
'Liquefied Natural Gas Storage'
]
df_all = pd.merge(util_gen, plant[plant_cols], on='Plant Code')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment