vd-pge
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
vd-pge [2021/08/09 22:57] – created dblume | vd-pge [2023/04/12 20:44] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Analyzing PG&E data with VisiData ====== | ====== Analyzing PG&E data with VisiData ====== | ||
- | PG&E CSVs come with 5 rows of metadata followed by Type, Date, Start Time, End Time, Usage, Units, Cost, Notes columns. Delete the five rows of metadata in a text editor, or use '' | + | At the PG&E website, you can download a CSV table of your energy usage. Click " |
+ | |||
+ | {{: | ||
+ | |||
+ | PG&E CSVs come with 5 rows of metadata followed by '' | ||
tail +6 pge_electric_interval_data.csv | vd -f csv - | tail +6 pge_electric_interval_data.csv | vd -f csv - | ||
Then prepare your PG&E data like so: | Then prepare your PG&E data like so: | ||
+ | |||
+ | ===== Set Column Types, Widths, Names, Importance ===== | ||
^ Key ^ Meaning ^ | ^ Key ^ Meaning ^ | ||
| - | Hide columns TYPE, END TIME, UNITS and NOTES | | | - | Hide columns TYPE, END TIME, UNITS and NOTES | | ||
+ | | = | Create a new column for weekday. Enter " | ||
+ | | = | Create a new column for weekday name. Enter " | ||
+ | | %%^%% | Rename "START TIME" to one word since column names should be one word for Python expressions. | | ||
| C | Go to column mode and... | | | C | Go to column mode and... | | ||
| t | Select the DATE and START TIME columns | | | t | Select the DATE and START TIME columns | | ||
| & | Make a new column that merges them | | | & | Make a new column that merges them | | ||
- | | q, - | Quit the Column mode, hide DATE and START TIME columns | | + | | - | (Optionally delete some columns' |
+ | | q, - | Quit the Column mode, hide (sets their width to 0) DATE and START TIME columns | | ||
| O | Go to options mode and... | | | O | Go to options mode and... | | ||
- | | e | Set '' | + | | e | Set '' |
| q | Quit options mode. | | | q | Quit options mode. | | ||
| @!, %, $ | Set DATE_START_TIME to date format and important, USAGE to float, COST to currency | | | @!, %, $ | Set DATE_START_TIME to date format and important, USAGE to float, COST to currency | | ||
| = | Add a column, enter '' | | = | Add a column, enter '' | ||
| %%^%% | Rename COST/USAGE to '' | | %%^%% | Rename COST/USAGE to '' | ||
+ | | H,V and _ | Move and resize the columns. | | ||
+ | |||
+ | You should end up with a sheet with usable data. Note that '' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== View average usage by hour of day ===== | ||
+ | |||
+ | ^ Key ^ Meaning ^ | ||
+ | | - | Hide all columns, leaving only '' | ||
+ | | + | On '' | ||
+ | | F | On the '' | ||
+ | | [ | The frequency table is sorted on the new aggregations, | ||
+ | | - | Remove the new '' | ||
+ | | C, e, " | ||
+ | | g. | Display a graph with all visible columns. | | ||
+ | | -, + | Zoom in and out of the graph. | | ||
+ | | q, q | Quit the graph, quit the frequency sheet | | ||
+ | | C, t, ge, 8 | Column mode, toggle '' | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ===== View average usage by day of week ===== | ||
+ | |||
+ | ^ Key ^ Meaning ^ | ||
+ | | - | Hide all columns, leaving only '' | ||
+ | | C, t, & | Column mode, toggle '' | ||
+ | | = | With '' | ||
+ | |||
+ | ===== Select Rows to Analyze ===== | ||
+ | |||
+ | Directly selecting ranges of rows: | ||
+ | |||
+ | ^ Key ^ Meaning ^ | ||
+ | | s,t,u | Select/ | ||
+ | | , | Select all rows matching value of current cell | | ||
+ | | gs,gt,gu | ... all rows | | ||
+ | | zs,zt,zu | ... from top to cursor | | ||
+ | | gzs,gzt,gzu | ... from cursor to bottom (Or... '' | ||
+ | | " | Open duplicate sheet with only selected rows. | | ||
+ | |||
+ | Select based on a pattern: | ||
+ | |||
+ | ^ Key ^ Meaning ^ | ||
+ | | %%|%% | On DATE_START_TIME column, select by regex, like " | ||
+ | | %%z|%% | Select rows matching Python expr " | ||
+ | | " | To open a new sheet with just those selected rows. | | ||
+ | |||
+ | |||
+ | ===== Visualize Data ===== | ||
+ | |||
+ | ^ Key ^ Meaning ^ | ||
| . or g. | Select columns to graph them. Notice rate changes. Notice times of high use. | | | . or g. | Select columns to graph them. Notice rate changes. Notice times of high use. | | ||
| +, - | Navigate with hjkl, zoom in and out ([[https:// | | +, - | Navigate with hjkl, zoom in and out ([[https:// | ||
+ | |||
+ | ====== Further Resources ====== | ||
+ | |||
+ | I have another tutorial at [[vd]] that merges/ |
vd-pge.1628575073.txt.gz · Last modified: 2023/04/12 20:44 (external edit)