PV Watts Scripting

We want to perform our time of use computation with the value of the solar electricity but using Python to perform calculations rather than a spreadsheet.

Tools

Try Jupyter is an browser-based online development environment that we will use for Python. Students have had the best success using the Chrome browser for this.

Pandas is a python library for panel data. We can think of it like a spreadsheet replacement.

Numpy, is a python library for numerical computations. It provides mathematical functions and algorithms for computation.

Array Programming

Using Pandas and Numpy we can do math on an entire column of data with one command. This is different than making a copy of the formula for every row in the spreadsheet.

Group By

To sum the data by month, we will use the group by function.

We group a data column (energy or power) by another data column (the month) and then perform a computation on the separate groups (a sum of each month).

This is called a group by, or a split-apply-combine.

If-Then programming

To perform if-then using array programming, there is a function called where.

This works similar to what we did in the spreadsheet.

data.where(cond, {this value if true}, {this value if false})