0% found this document useful (0 votes)
13 views

Ve Scripts Benchmarking Consumption Data Cbecs

Cbrbbbbbbbbbbbbbbbbb. Bhhhhhhhhhgghhhhinhhkkbbhh

Uploaded by

Daxesh Shah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Ve Scripts Benchmarking Consumption Data Cbecs

Cbrbbbbbbbbbbbbbbbbb. Bhhhhhhhhhgghhhhinhhkkbbhh

Uploaded by

Daxesh Shah
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python in the VE

VE Scripts – Benchmarking consumption data CBECS (USA)

What? In this article we look at a script that uses publicly available data (CBECS) on energy use in commercial buildings
to produce a range of benchmarks by climate zone and building category.

Why? The Commercial Buildings Energy Consumption Survey (CBECS) is a national sample survey that collects
information on the stock of U.S. commercial buildings, including their energy-related building characteristics
and energy usage data. See https://www.eia.gov/consumption/commercial/about.php

CBECS Microdata is utilised. Download the Microdata from https://www.eia.gov/consumption/commercial/


data/2018/index.php?view=microdata:

The Codebook and User’s guide provide detail on the data utilised by the script.

Note that the records held in the CSV dataset represent CBECS data observations do not correspond to real
buildings but are instead presented as an abstraction, which is to say that for every observation there
is a given number of buildings that are supposed to be represented by that observation that that number is
provided by the FINALWT field.

The script processes the CBECS Microdata to generate quantile data filtered by climate zone and building
category.

A similar script to process RECS Microdata is also provided. Download the Microdata from https://
www.eia.gov/consumption/residential/data/2020/index.php?view=microdata

Readme comments

Metric only

Import modules

Get the script’s directory

We use the __name__ conditional to


ensure we only run the script when it
is the main program

Create the pathname for the CSV file


assuming it is placed in the same
directory as the script

Read the CSV file into dataframe


Get a list of the dataframe columns

Create a list columns that are


required

List comprehension – create a list of


columns that will be deleted

Use df.drop to remove all unwanted


columns. Inplace True changes the
dataframe in place

Rename key columns that we will


output with more readable labels

Handle the case of missing data –


replace with zeros

Notes of data column labels and what


they contain

Convert IP units to metric

Create an EUI column using the data


in two other columns

Drop any rows where the EUI is zero


(Index refers to rows)

Create a dict of type # : label so the


output will be more readable

Use a lambda function to apply the


type # : label mapping to the
dataframe ‘Building type’ column

Sort the dataframe rows by climate


zone then by Building type
Use groupby function by
climate zone & Building
type to group rows to
determine the number of
buildings for the group.
This returns a new
dataframe with each group
as a row with mean sum
NMBR ... as columns

Use groupby function by climate zone &


Building type to group rows to determine
the mean building floor area for the
group. This returns a new dataframe with
each group as a row with mean M2 as
columns

Define some functions to calculate


quantiles

Use groupby function by


climate zone & Building type
to group rows to determine
the a series of quantiles for
the group. This returns a new
dataframe with each group as
a row with the quantile as
columns

The groupby dataframes have the


same shape so we can combine them:
axis=1 is concatenate along the
column axis, outer preserves all data

Export dataframes to spreadsheets

Output ...
Export dataframes to an SQLite
database (optional)

You might also like