chalseee commited on
Commit
e3d9b90
·
verified ·
1 Parent(s): cfef40e

Sync from GitHub via hub-sync

Browse files
README.md CHANGED
@@ -9,7 +9,8 @@ app_file: streamlit_app.py
9
  pinned: false
10
  ---
11
 
12
- # Electricity Utility Inefficiency & Residential Rate Analysis
 
13
 
14
  > **Research Question:** Are system-level inefficiencies — high energy losses and poor load factors — statistically correlated with higher retail rates for residential consumers?
15
 
@@ -21,7 +22,8 @@ This project investigates a fundamental fairness question in the U.S. electricit
21
 
22
  New York State serves as the primary case study. NY was selected through a data-driven ranking process (get_state_variance) that scores all 50 states across five analytical criteria: number of utilities, number of ownership types, residential price standard deviation, maximum system loss percentage, and industrial revenue dependency. New York ranks at or near the top on all five: it has over 100 utilities across 6 distinct ownership models, exhibits high residential price variance, and sits within one of the most actively scrutinized regulatory environments in the U.S.
23
 
24
- [![Open in HF Space](https://huggingface.co/datasets/huggingface/badges/resolve/main/open-in-hf-spaces-sm.svg)](https://huggingface.co/spaces/chalseee/utilities-equity-efficiency-gap)
 
25
  ---
26
 
27
  ## Key Metrics
@@ -56,14 +58,12 @@ New York State serves as the primary case study. NY was selected through a data-
56
  ├── requirements.txt
57
  ├── README.md
58
  ├── data/
 
59
  │ └── app.py
60
  │ └── electricity.data
61
  │ └── electricity.data
62
  ├── src/
63
- │ └── util/
64
- │ ├── data_util.py
65
- │ └── plot_util.py
66
- └── images/
67
  ```
68
 
69
  The three modules work as a clean pipeline:
@@ -89,7 +89,7 @@ The three modules work as a clean pipeline:
89
 
90
  - The dataset is pre-bundled — no external downloads required for it.
91
  - Run `jupytr notebook utility_efficiency_fairness.ipynb.`
92
- - Run pip install pandas plotly scipy kaleido streamlit
93
 
94
  ---
95
 
 
9
  pinned: false
10
  ---
11
 
12
+
13
+ # Electricity Utility Fairness Residential Rate Analysis
14
 
15
  > **Research Question:** Are system-level inefficiencies — high energy losses and poor load factors — statistically correlated with higher retail rates for residential consumers?
16
 
 
22
 
23
  New York State serves as the primary case study. NY was selected through a data-driven ranking process (get_state_variance) that scores all 50 states across five analytical criteria: number of utilities, number of ownership types, residential price standard deviation, maximum system loss percentage, and industrial revenue dependency. New York ranks at or near the top on all five: it has over 100 utilities across 6 distinct ownership models, exhibits high residential price variance, and sits within one of the most actively scrutinized regulatory environments in the U.S.
24
 
25
+ [![Open in Streamlit](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://your-app-url.streamlit.app)
26
+
27
  ---
28
 
29
  ## Key Metrics
 
58
  ├── requirements.txt
59
  ├── README.md
60
  ├── data/
61
+ │ └── electricity.py
62
  │ └── app.py
63
  │ └── electricity.data
64
  │ └── electricity.data
65
  ├── src/
66
+ │ └── util/
 
 
 
67
  ```
68
 
69
  The three modules work as a clean pipeline:
 
89
 
90
  - The dataset is pre-bundled — no external downloads required for it.
91
  - Run `jupytr notebook utility_efficiency_fairness.ipynb.`
92
+ - Run `pip install pandas plotly scipy kaleido streamlit`
93
 
94
  ---
95
 
src/util/plot_util.py CHANGED
@@ -45,7 +45,6 @@ def get_state_variance_table(df: pd.DataFrame) -> go.Figure:
45
 
46
  return fig
47
 
48
-
49
  def get_price_spread_strip_plot(df: pd.DataFrame):
50
  """
51
  Strip plot of Price Spread by ownership model.
 
45
 
46
  return fig
47
 
 
48
  def get_price_spread_strip_plot(df: pd.DataFrame):
49
  """
50
  Strip plot of Price Spread by ownership model.
streamlit_app.py CHANGED
@@ -1,11 +1,14 @@
1
- import streamlit.src.util.plot_util as plot_util
2
- import streamlit.src.util.data_util as data_util
 
 
 
 
3
  import data.electricity as electricity
4
 
5
  import streamlit as st
6
  import pandas as pd
7
 
8
-
9
  st.set_page_config(
10
  page_title="Utility Efficiency & Rates",
11
  layout="wide"
@@ -118,4 +121,4 @@ utility_flow = data_util.get_utility_usage(utility_row, level="Utility")
118
  st.plotly_chart(
119
  plot_util.get_energy_use_sankey_plot(utility_flow),
120
  use_container_width=True
121
- )
 
1
+ import sys
2
+ import os
3
+ sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
4
+
5
+ import src.util.plot_util as plot_util
6
+ import src.util.data_util as data_util
7
  import data.electricity as electricity
8
 
9
  import streamlit as st
10
  import pandas as pd
11
 
 
12
  st.set_page_config(
13
  page_title="Utility Efficiency & Rates",
14
  layout="wide"
 
121
  st.plotly_chart(
122
  plot_util.get_energy_use_sankey_plot(utility_flow),
123
  use_container_width=True
124
+ )
utility_efficiency_fairness.ipynb CHANGED
@@ -139,14 +139,147 @@
139
  "---\n",
140
  "## 3. Ownership Model Analysis\n",
141
  "\n",
142
- "Before testing the efficiency hypothesis, we establish baseline pricing distributions by ownership model. This matters because ownership type is a structural variable — investor-owned utilities (IOUs) answer to shareholders and profit motives, while cooperatives and municipals serve member-owners or public ratepayers. If ownership type already explains most of the price variance, efficiency metrics may be redundant."
143
  ]
144
  },
145
  {
146
  "cell_type": "code",
147
- "execution_count": 11,
148
  "id": "54f2b308",
149
  "metadata": {},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
  "outputs": [
151
  {
152
  "data": {
@@ -156,417 +289,77 @@
156
  },
157
  "data": [
158
  {
159
- "alignmentgroup": "True",
160
- "boxpoints": "all",
161
- "fillcolor": "rgba(255,255,255,0)",
162
- "hoveron": "points",
163
- "hovertemplate": "<b>%{hovertext}</b><br><br>Type=%{x}<br>Residential Premium ($/MWh)=%{y}<extra></extra>",
164
- "hovertext": [
165
- "Agway Energy Services, LLC",
166
- "Energy Coop of New York, Inc",
167
- "Robison Energy, LLC",
168
- "U.S. Energy Partners LLC",
169
- "NOCO Electric",
170
- "Columbia Utilities Power, LLC",
171
- "Hudson Energy Services",
172
- "Palmco Power NJ, LLC",
173
- "Major Energy Electric Services",
174
- "Palmco Power PA, LLC",
175
- "Palmco Power MD, LLC",
176
- "Plymouth Rock Energy, LLC",
177
- "Palmco Power OH, LLC",
178
- "Stream Energy New York, LLC",
179
- "EnergyMark, LLC",
180
- "Palmco Power IL, LLC",
181
- "Respond Power LLC",
182
- "Kiwi Energy NY LLC",
183
- "SmartEnergy Holdings, LLC",
184
- "Alpha Gas and Electric, LLC",
185
- "Energy.Me Midwest LLC",
186
- "Marathon Power LLC",
187
- "Harborside Energy, LLC",
188
- "Abest Power & Gas, LLC",
189
- "MPower Energy LLC",
190
- "Palmco Power MA, LLC",
191
- "Agera Energy LLC",
192
- "Greenlight Energy Inc.",
193
- "New Wave Energy Corporation",
194
- "HIKO Energy, LLC",
195
- "Aequitas Energy Inc",
196
- "Great Eastern Energy",
197
- "East Coast Power & Gas, LLC",
198
- "Spring Energy RRH LLC dba Spring Power &",
199
- "MPower Energy NJ LLC",
200
- "Atlantic Energy LLC",
201
- "Palmco Power DC, LLC",
202
- "Palmco Power DE, LLC",
203
- "South Bay Energy Corp.",
204
- "Flanders Energy, LLC",
205
- "Pure Energy USA, LLC",
206
- "First Choice Energy LLC",
207
- "Agressive Energy LLC"
208
- ],
209
- "legendgroup": "Retail Power Marketer",
210
- "line": {
211
- "color": "rgba(255,255,255,0)"
212
- },
213
- "marker": {
214
- "color": "rgb(95, 70, 144)"
215
- },
216
- "name": "Retail Power Marketer",
217
- "offsetgroup": "Retail Power Marketer",
218
- "orientation": "v",
219
- "pointpos": 0,
220
- "showlegend": true,
221
- "type": "box",
222
- "x": [
223
- "Retail Power Marketer",
224
- "Retail Power Marketer",
225
- "Retail Power Marketer",
226
- "Retail Power Marketer",
227
- "Retail Power Marketer",
228
- "Retail Power Marketer",
229
- "Retail Power Marketer",
230
- "Retail Power Marketer",
231
- "Retail Power Marketer",
232
- "Retail Power Marketer",
233
- "Retail Power Marketer",
234
- "Retail Power Marketer",
235
- "Retail Power Marketer",
236
- "Retail Power Marketer",
237
- "Retail Power Marketer",
238
- "Retail Power Marketer",
239
- "Retail Power Marketer",
240
- "Retail Power Marketer",
241
- "Retail Power Marketer",
242
- "Retail Power Marketer",
243
- "Retail Power Marketer",
244
- "Retail Power Marketer",
245
- "Retail Power Marketer",
246
- "Retail Power Marketer",
247
- "Retail Power Marketer",
248
- "Retail Power Marketer",
249
- "Retail Power Marketer",
250
- "Retail Power Marketer",
251
- "Retail Power Marketer",
252
- "Retail Power Marketer",
253
- "Retail Power Marketer",
254
- "Retail Power Marketer",
255
- "Retail Power Marketer",
256
- "Retail Power Marketer",
257
- "Retail Power Marketer",
258
- "Retail Power Marketer",
259
- "Retail Power Marketer",
260
- "Retail Power Marketer",
261
- "Retail Power Marketer",
262
- "Retail Power Marketer",
263
- "Retail Power Marketer",
264
- "Retail Power Marketer",
265
- "Retail Power Marketer"
266
- ],
267
- "x0": " ",
268
- "xaxis": "x",
269
- "y": {
270
- "bdata": "1HdJqZaIVEDlcPM237NFQJ4t+TeSfVVA9Y6hQZjxREC7n0AeSF5FQAJayxan5mdA+NB2EXoPWEDkHoKBHplrQAf1wZiCkFxAdfEDDupzYUBcKbC7K7hjQNg9bETnNGBAwv1PMJqEXEBzGFLAfrxQQMb9Fc3b/0VA4ydnH2Q/VkBOiMxbaUtiQE1aVCBa8FtAdyZPlzdMWUD/BbayJZdaQNFZ0CR2H1NAVaW6iXyDUkAWCcnsvT5kQL6sGTMR6VRAOFE8FqijYEDwxWACoKxkQLReHZWsKFhANJ/x5rw1XUAUtkGpzFhMQEG4G/seUWFA7ZpZKnJNXEC+qlbjMDJZQMjcovLsXVRAJYv3tlpiWkAv2u+X74BeQM7YHwYLZ2BAFkOHeY7iW0DXGD4bRKpZQNjxRK4pNV9AnhCBas4qZEATgY2Ufz1jQNvxsf19yVhAbl5aGi50UUA=",
271
- "dtype": "f8"
272
- },
273
- "y0": " ",
274
- "yaxis": "y"
275
- },
276
- {
277
- "alignmentgroup": "True",
278
- "boxpoints": "all",
279
- "fillcolor": "rgba(255,255,255,0)",
280
- "hoveron": "points",
281
- "hovertemplate": "<b>%{hovertext}</b><br><br>Type=%{x}<br>Residential Premium ($/MWh)=%{y}<extra></extra>",
282
- "hovertext": [
283
- "Village of Arcade - (NY)",
284
- "Village of Akron - (NY)",
285
- "Village of Andover - (NY)",
286
- "Village of Angelica - (NY)",
287
- "Bath Electric Gas & Water",
288
- "Village of Bergen - (NY)",
289
- "Village of Boonville - (NY)",
290
- "Village of Brocton - (NY)",
291
- "Village of Castile - (NY)",
292
- "Village of Churchville - (NY)",
293
- "Village of Endicott - (NY)",
294
- "Village of Fairport - (NY)",
295
- "Village of Frankfort - (NY)",
296
- "Village of Freeport - (NY)",
297
- "Village of Green Island - (NY)",
298
- "Village of Greene - (NY)",
299
- "Village of Groton - (NY)",
300
- "Village of Hamilton - (NY)",
301
- "Village of Holley - (NY)",
302
- "Village of Ilion - (NY)",
303
- "Jamestown Board of Public Util",
304
- "Lake Placid Village, Inc - (NY)",
305
- "Village of Little Valley - (NY)",
306
- "Village of Marathon - (NY)",
307
- "Town of Massena - (NY)",
308
- "Village of Mayville - (NY)",
309
- "Mohawk Municipal Comm",
310
- "Village of Penn Yan - (NY)",
311
- "Village of Philadelphia - (NY)",
312
- "City of Plattsburgh - (NY)",
313
- "Village of Richmondville - (NY)",
314
- "Village of Rockville Centre - (NY)",
315
- "Village of Rouses Point - (NY)",
316
- "City of Salamanca - (NY)",
317
- "Village of Sherburne - (NY)",
318
- "City of Sherrill - (NY)",
319
- "Village of Silver Springs - (NY)",
320
- "Village of Skaneateles - (NY)",
321
- "Village of Solvay - (NY)",
322
- "Village of Spencerport - (NY)",
323
- "Village of Springville - (NY)",
324
- "Village of Theresa - (NY)",
325
- "Village of Tupper Lake - (NY)",
326
- "Village of Watkins Glen - (NY)",
327
- "Village of Wellsville - (NY)",
328
- "Village of Westfield - (NY)"
329
- ],
330
- "legendgroup": "Municipal",
331
- "line": {
332
- "color": "rgba(255,255,255,0)"
333
- },
334
- "marker": {
335
- "color": "rgb(29, 105, 150)"
336
- },
337
- "name": "Municipal",
338
- "offsetgroup": "Municipal",
339
- "orientation": "v",
340
- "pointpos": 0,
341
- "showlegend": true,
342
- "type": "box",
343
- "x": [
344
- "Municipal",
345
- "Municipal",
346
- "Municipal",
347
- "Municipal",
348
- "Municipal",
349
- "Municipal",
350
- "Municipal",
351
- "Municipal",
352
- "Municipal",
353
- "Municipal",
354
- "Municipal",
355
- "Municipal",
356
- "Municipal",
357
- "Municipal",
358
- "Municipal",
359
- "Municipal",
360
- "Municipal",
361
- "Municipal",
362
- "Municipal",
363
- "Municipal",
364
- "Municipal",
365
- "Municipal",
366
- "Municipal",
367
- "Municipal",
368
- "Municipal",
369
- "Municipal",
370
- "Municipal",
371
- "Municipal",
372
- "Municipal",
373
- "Municipal",
374
- "Municipal",
375
- "Municipal",
376
- "Municipal",
377
- "Municipal",
378
- "Municipal",
379
- "Municipal",
380
- "Municipal",
381
- "Municipal",
382
- "Municipal",
383
- "Municipal",
384
- "Municipal",
385
- "Municipal",
386
- "Municipal",
387
- "Municipal",
388
- "Municipal",
389
- "Municipal"
390
- ],
391
- "x0": " ",
392
- "xaxis": "x",
393
- "y": {
394
- "bdata": "4zx0l/glSkCrn6PKMxZKQDFIRJo2x0VAGOWbWs1/T0CCUB+yIaJNQEZpzEOSWVNAykfneWTjSUC5RSoUu+tGQD5k23fSFk1Azmj3sPXNUkDJCaumGFlQQBb2vzXcvktA7+AqSao3Q0CQqdv9nMlfQC8zhjbsPltAXfLkhENnS0DUHfrfiDZKQJdz0sw7pkhAl5Nt4wsgTkCCI8bcBMRKQNIB9qAznlRAw5X6vW53S0At0Q+nexBTQCjVNgwQnVFASdVlz85LTkAsdSyDtF5QQNhzo/V/JkVArLuSbKG6QkCXOXo4ck9OQMfHf05/EUdAK8FbUIDWUkDSX/M3ctteQF6gAPx8Ej1Aw45Qct0fSUC0jal315FLQNRIT1cjHU1AjVKkDWvMUUDTH1W7sehEQAeqFkKflkxAe68yr+vZRkBpZcd2fvFKQMx1qVre1FNApaDbJmbZSkCWccuMD2tCQNSJR5YBWU5ARDUJMx5yTEA=",
395
- "dtype": "f8"
396
- },
397
- "y0": " ",
398
- "yaxis": "y"
399
- },
400
- {
401
- "alignmentgroup": "True",
402
- "boxpoints": "all",
403
- "fillcolor": "rgba(255,255,255,0)",
404
- "hoveron": "points",
405
- "hovertemplate": "<b>%{hovertext}</b><br><br>Type=%{x}<br>Residential Premium ($/MWh)=%{y}<extra></extra>",
406
- "hovertext": [
407
- "Central Hudson Gas & Elec Corp",
408
- "Consolidated Edison Co-NY Inc",
409
- "Fishers Island Utility Co Inc",
410
- "Massachusetts Electric Co",
411
- "New York State Elec & Gas Corp",
412
- "Niagara Mohawk Power Corp.",
413
- "Orange & Rockland Utils Inc",
414
- "Pike County Light & Power Co",
415
- "Rochester Gas & Electric Corp",
416
- "Rockland Electric Co"
417
- ],
418
- "legendgroup": "Investor Owned",
419
- "line": {
420
- "color": "rgba(255,255,255,0)"
421
- },
422
- "marker": {
423
- "color": "rgb(56, 166, 165)"
424
- },
425
- "name": "Investor Owned",
426
- "offsetgroup": "Investor Owned",
427
- "orientation": "v",
428
- "pointpos": 0,
429
- "showlegend": true,
430
- "type": "box",
431
- "x": [
432
- "Investor Owned",
433
- "Investor Owned",
434
- "Investor Owned",
435
- "Investor Owned",
436
- "Investor Owned",
437
- "Investor Owned",
438
- "Investor Owned",
439
- "Investor Owned",
440
- "Investor Owned",
441
- "Investor Owned"
442
- ],
443
- "x0": " ",
444
- "xaxis": "x",
445
- "y": {
446
- "bdata": "DlfHeglgZEAky8QEPyJtQOHh4eHh4XNAiNVwftXYZkBAg+xCRm5aQLlstvUwUV1AP0jm2o/iZEC7M68wZX1eQCRaHECiYF5AzRC7X0JqY0A=",
447
- "dtype": "f8"
448
- },
449
- "y0": " ",
450
- "yaxis": "y"
451
- },
452
- {
453
- "alignmentgroup": "True",
454
- "boxpoints": "all",
455
- "fillcolor": "rgba(255,255,255,0)",
456
- "hoveron": "points",
457
- "hovertemplate": "<b>%{hovertext}</b><br><br>Type=%{x}<br>Residential Premium ($/MWh)=%{y}<extra></extra>",
458
- "hovertext": [
459
- "Delaware County Elec Coop Inc",
460
- "North Shore Towers Apts Inc",
461
- "Otsego Electric Coop, Inc",
462
- "Steuben Rural Elec Coop, Inc"
463
- ],
464
- "legendgroup": "Cooperative",
465
- "line": {
466
- "color": "rgba(255,255,255,0)"
467
- },
468
- "marker": {
469
- "color": "rgb(15, 133, 84)"
470
- },
471
- "name": "Cooperative",
472
- "offsetgroup": "Cooperative",
473
- "orientation": "v",
474
- "pointpos": 0,
475
- "showlegend": true,
476
- "type": "box",
477
- "x": [
478
- "Cooperative",
479
- "Cooperative",
480
- "Cooperative",
481
- "Cooperative"
482
- ],
483
- "x0": " ",
484
- "xaxis": "x",
485
- "y": {
486
- "bdata": "+aWVpF9ZYUDMuXx9SDRxQE3e4teNEl9Aw0BzNP3fXkA=",
487
- "dtype": "f8"
488
- },
489
- "y0": " ",
490
- "yaxis": "y"
491
- },
492
- {
493
- "alignmentgroup": "True",
494
- "boxpoints": "all",
495
- "fillcolor": "rgba(255,255,255,0)",
496
- "hoveron": "points",
497
- "hovertemplate": "<b>%{hovertext}</b><br><br>Type=%{x}<br>Residential Premium ($/MWh)=%{y}<extra></extra>",
498
- "hovertext": [
499
- "Long Island Power Authority"
500
- ],
501
- "legendgroup": "State",
502
- "line": {
503
- "color": "rgba(255,255,255,0)"
504
- },
505
- "marker": {
506
- "color": "rgb(115, 175, 72)"
507
- },
508
- "name": "State",
509
- "offsetgroup": "State",
510
- "orientation": "v",
511
- "pointpos": 0,
512
- "showlegend": true,
513
- "type": "box",
514
- "x": [
515
- "State"
516
- ],
517
- "x0": " ",
518
- "xaxis": "x",
519
- "y": {
520
- "bdata": "WOYOiWF7aUA=",
521
- "dtype": "f8"
522
- },
523
- "y0": " ",
524
- "yaxis": "y"
525
- },
526
- {
527
- "alignmentgroup": "True",
528
- "boxpoints": "all",
529
- "fillcolor": "rgba(255,255,255,0)",
530
- "hoveron": "points",
531
- "hovertemplate": "<b>%{hovertext}</b><br><br>Type=%{x}<br>Residential Premium ($/MWh)=%{y}<extra></extra>",
532
- "hovertext": [
533
- "Greenbacker Renewable Energy Corporation"
534
- ],
535
- "legendgroup": "Behind the Meter",
536
- "line": {
537
- "color": "rgba(255,255,255,0)"
538
- },
539
- "marker": {
540
- "color": "rgb(237, 173, 8)"
541
  },
542
- "name": "Behind the Meter",
543
- "offsetgroup": "Behind the Meter",
544
- "orientation": "v",
545
- "pointpos": 0,
546
- "showlegend": true,
547
- "type": "box",
548
- "x": [
549
- "Behind the Meter"
550
- ],
551
- "x0": " ",
552
- "xaxis": "x",
553
- "y": {
554
- "bdata": "tp977y/kYkA=",
555
- "dtype": "f8"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  },
557
- "y0": " ",
558
- "yaxis": "y"
 
559
  }
560
  ],
561
  "layout": {
562
- "boxmode": "overlay",
563
- "legend": {
564
- "title": {
565
- "text": "Type"
566
- },
567
- "tracegroupgap": 0
568
- },
569
- "showlegend": false,
570
  "template": {
571
  "data": {
572
  "bar": [
@@ -579,7 +372,7 @@
579
  },
580
  "marker": {
581
  "line": {
582
- "color": "white",
583
  "width": 0.5
584
  },
585
  "pattern": {
@@ -595,7 +388,7 @@
595
  {
596
  "marker": {
597
  "line": {
598
- "color": "white",
599
  "width": 0.5
600
  },
601
  "pattern": {
@@ -611,16 +404,16 @@
611
  {
612
  "aaxis": {
613
  "endlinecolor": "#2a3f5f",
614
- "gridcolor": "#C8D4E3",
615
- "linecolor": "#C8D4E3",
616
- "minorgridcolor": "#C8D4E3",
617
  "startlinecolor": "#2a3f5f"
618
  },
619
  "baxis": {
620
  "endlinecolor": "#2a3f5f",
621
- "gridcolor": "#C8D4E3",
622
- "linecolor": "#C8D4E3",
623
- "minorgridcolor": "#C8D4E3",
624
  "startlinecolor": "#2a3f5f"
625
  },
626
  "type": "carpet"
@@ -1237,10 +1030,10 @@
1237
  "geo": {
1238
  "bgcolor": "white",
1239
  "lakecolor": "white",
1240
- "landcolor": "white",
1241
  "showlakes": true,
1242
  "showland": true,
1243
- "subunitcolor": "#C8D4E3"
1244
  },
1245
  "hoverlabel": {
1246
  "align": "left"
@@ -1250,47 +1043,47 @@
1250
  "style": "light"
1251
  },
1252
  "paper_bgcolor": "white",
1253
- "plot_bgcolor": "white",
1254
  "polar": {
1255
  "angularaxis": {
1256
- "gridcolor": "#EBF0F8",
1257
- "linecolor": "#EBF0F8",
1258
  "ticks": ""
1259
  },
1260
- "bgcolor": "white",
1261
  "radialaxis": {
1262
- "gridcolor": "#EBF0F8",
1263
- "linecolor": "#EBF0F8",
1264
  "ticks": ""
1265
  }
1266
  },
1267
  "scene": {
1268
  "xaxis": {
1269
- "backgroundcolor": "white",
1270
- "gridcolor": "#DFE8F3",
1271
  "gridwidth": 2,
1272
- "linecolor": "#EBF0F8",
1273
  "showbackground": true,
1274
  "ticks": "",
1275
- "zerolinecolor": "#EBF0F8"
1276
  },
1277
  "yaxis": {
1278
- "backgroundcolor": "white",
1279
- "gridcolor": "#DFE8F3",
1280
  "gridwidth": 2,
1281
- "linecolor": "#EBF0F8",
1282
  "showbackground": true,
1283
  "ticks": "",
1284
- "zerolinecolor": "#EBF0F8"
1285
  },
1286
  "zaxis": {
1287
- "backgroundcolor": "white",
1288
- "gridcolor": "#DFE8F3",
1289
  "gridwidth": 2,
1290
- "linecolor": "#EBF0F8",
1291
  "showbackground": true,
1292
  "ticks": "",
1293
- "zerolinecolor": "#EBF0F8"
1294
  }
1295
  },
1296
  "shapedefaults": {
@@ -1300,19 +1093,19 @@
1300
  },
1301
  "ternary": {
1302
  "aaxis": {
1303
- "gridcolor": "#DFE8F3",
1304
- "linecolor": "#A2B1C6",
1305
  "ticks": ""
1306
  },
1307
  "baxis": {
1308
- "gridcolor": "#DFE8F3",
1309
- "linecolor": "#A2B1C6",
1310
  "ticks": ""
1311
  },
1312
- "bgcolor": "white",
1313
  "caxis": {
1314
- "gridcolor": "#DFE8F3",
1315
- "linecolor": "#A2B1C6",
1316
  "ticks": ""
1317
  }
1318
  },
@@ -1321,59 +1114,30 @@
1321
  },
1322
  "xaxis": {
1323
  "automargin": true,
1324
- "gridcolor": "#EBF0F8",
1325
- "linecolor": "#EBF0F8",
1326
  "ticks": "",
1327
  "title": {
1328
  "standoff": 15
1329
  },
1330
- "zerolinecolor": "#EBF0F8",
1331
  "zerolinewidth": 2
1332
  },
1333
  "yaxis": {
1334
  "automargin": true,
1335
- "gridcolor": "#EBF0F8",
1336
- "linecolor": "#EBF0F8",
1337
  "ticks": "",
1338
  "title": {
1339
  "standoff": 15
1340
  },
1341
- "zerolinecolor": "#EBF0F8",
1342
  "zerolinewidth": 2
1343
  }
1344
  }
1345
  },
1346
  "title": {
1347
- "text": "<b>Rate Equity by Ownership Model:</b> Residential Premium Over Industrial Rates"
1348
- },
1349
- "xaxis": {
1350
- "anchor": "y",
1351
- "categoryarray": [
1352
- "Retail Power Marketer",
1353
- "Municipal",
1354
- "Investor Owned",
1355
- "Cooperative",
1356
- "State",
1357
- "Behind the Meter"
1358
- ],
1359
- "categoryorder": "array",
1360
- "domain": [
1361
- 0,
1362
- 1
1363
- ],
1364
- "title": {
1365
- "text": "Type"
1366
- }
1367
- },
1368
- "yaxis": {
1369
- "anchor": "x",
1370
- "domain": [
1371
- 0,
1372
- 1
1373
- ],
1374
- "title": {
1375
- "text": "Residential Premium ($/MWh)"
1376
- }
1377
  }
1378
  }
1379
  }
@@ -1382,147 +1146,6 @@
1382
  "output_type": "display_data"
1383
  }
1384
  ],
1385
- "source": [
1386
- "strip_plot = plot_util.get_price_spread_strip_plot(ny_df)\n",
1387
- "\n",
1388
- "strip_plot.show()"
1389
- ]
1390
- },
1391
- {
1392
- "cell_type": "markdown",
1393
- "id": "99326360",
1394
- "metadata": {},
1395
- "source": [
1396
- "**Interpretation:** Investor-owned utilities dominate rates on the high end, but the spread within each ownership category is wide enough that ownership type alone doesn't fully explain the disparity. There's meaningful variation within ownership types worth investigating."
1397
- ]
1398
- },
1399
- {
1400
- "cell_type": "markdown",
1401
- "id": "42f0d824",
1402
- "metadata": {},
1403
- "source": [
1404
- "---\n",
1405
- "## 4. Correlation Analysis\n",
1406
- "\n",
1407
- "Before building directional charts, we compute a Pearson correlation matrix across all key metrics. This serves two purposes: it quantifies the *strength and direction* of every pairwise relationship, and it surfaces any unexpected correlations that warrant further investigation. A positive correlation between `SystemLossPercentage` and `ResidentialUnitPrice` would support the hypothesis. A negative correlation between `LoadFactor` and `ResidentialUnitPrice` (higher efficiency → lower price) would also support it."
1408
- ]
1409
- },
1410
- {
1411
- "cell_type": "code",
1412
- "execution_count": 5,
1413
- "id": "6e0480c9",
1414
- "metadata": {},
1415
- "outputs": [],
1416
- "source": [
1417
- "# Key metrics: System Loss %, Load Factor', Industrial Revenue %, Price Spread\n",
1418
- "heatmap = plot_util.get_key_metrics_corr_matrix(ny_df)\n",
1419
- "\n",
1420
- "# heatmap.show()"
1421
- ]
1422
- },
1423
- {
1424
- "cell_type": "markdown",
1425
- "id": "0003dd2d",
1426
- "metadata": {},
1427
- "source": [
1428
- "**Interpretation:** The heatmap gives us a first look at which efficiency metrics are most predictive of residential pricing. The strong negative correlation between `LoadFactor` and both `ResidentialUnitPrice` and PriceSpread stands out immediately — it suggests infrastructure utilization is a meaningful driver of what residential customers pay. `SystemLossPercentage` shows a weaker positive relationship, which we'll test directly in the next section."
1429
- ]
1430
- },
1431
- {
1432
- "cell_type": "markdown",
1433
- "id": "c92e34ee",
1434
- "metadata": {},
1435
- "source": [
1436
- "---\n",
1437
- "## 5. Fairness Audit — Efficiency vs. Residential Price\n",
1438
- "\n",
1439
- "This is the central test of the research question, presented as two side-by-side scatter plots sharing a y-axis (residential price). Each plot approaches inefficiency from a different angle:\n",
1440
- "\n",
1441
- "| Plot | X-axis | What it tests |\n",
1442
- "|---|---|---|\n",
1443
- "| Left | `SystemLossPercentage` | Does wasted energy in the grid cost residential customers more? |\n",
1444
- "| Right | `LoadFactor` | Does underutilized infrastructure translate to higher per-MWh costs? |\n",
1445
- "\n",
1446
- "> **Filtering note:** This chart excludes utilities with zero system loss or zero load factor. These edge cases typically represent pass-through entities (pure resellers) or data reporting anomalies — including them would distort the OLS fit."
1447
- ]
1448
- },
1449
- {
1450
- "cell_type": "code",
1451
- "execution_count": 6,
1452
- "id": "de2b920d",
1453
- "metadata": {},
1454
- "outputs": [],
1455
- "source": [
1456
- "# Keep residential utilities that are using energy (instead of ONLY reseale, etc.)\n",
1457
- "residential_lf_sys_loss_df = data_util.get_residential_sys_loss(ny_df)\n",
1458
- "residential_lf_sys_loss_df = data_util.get_residential_load_factor(\n",
1459
- " residential_lf_sys_loss_df).round(2)\n",
1460
- "\n",
1461
- "dual_y_scatter = plot_util.get_fairness_dual_y_scatter_plot(\n",
1462
- " residential_lf_sys_loss_df)\n",
1463
- "\n",
1464
- "# dual_y_scatter.show()"
1465
- ]
1466
- },
1467
- {
1468
- "cell_type": "markdown",
1469
- "id": "ccdd7bc3",
1470
- "metadata": {},
1471
- "source": [
1472
- "**Interpretation:** The results are asymmetric: load factor explains 41.7% of residential price variance (R² = 0.417, p < 0.001), a statistically strong relationship. System loss explains 10.8% (R² = 0.108, p = 0.016) — modest but significant. The core hypothesis holds, but the mechanism differs: it is primarily underutilized infrastructure, not transmission waste, that correlates with higher residential rates in New York's utility landscape."
1473
- ]
1474
- },
1475
- {
1476
- "cell_type": "markdown",
1477
- "id": "c69057f2",
1478
- "metadata": {},
1479
- "source": [
1480
- "---\n",
1481
- "## 6. Rate Disparity — Residential vs. Industrial\n",
1482
- "\n",
1483
- "Even if inefficiency drives prices up overall, the burden may not fall equally. This chart examines the **top 10 utilities by Price Spread** — the gap between what residential and industrial customers pay per MWh. Industrial customers typically negotiate volume discounts — some spread is expected. But when residential customers pay 2–3× the industrial rate at the same utility, it raises questions about whether the rate structure reflects true cost-of-service differences or something else. This chart identifies the specific utilities where that premium is most extreme."
1484
- ]
1485
- },
1486
- {
1487
- "cell_type": "code",
1488
- "execution_count": 7,
1489
- "id": "38d3d584",
1490
- "metadata": {},
1491
- "outputs": [],
1492
- "source": [
1493
- "# Keep utilities that offer both industrial and residential services\n",
1494
- "res_ind_customers_df = data_util.get_customer_utilities(ny_df).round(2)\n",
1495
- "\n",
1496
- "dumbbell = plot_util.get_rate_disparity_dumbbell_plot(res_ind_customers_df)\n",
1497
- "\n",
1498
- "# dumbbell.show()"
1499
- ]
1500
- },
1501
- {
1502
- "cell_type": "markdown",
1503
- "id": "86fe4d1f",
1504
- "metadata": {},
1505
- "source": [
1506
- "**Interpretation:** Con Edison (Consolidated Edison) shows the largest residential–industrial spread in the dataset, charging residential customers roughly $233/MWh against a near-zero industrial rate. Eight of the top ten utilities by spread are investor-owned — consistent with the box plot finding that IOUs exhibit the widest pricing distributions. Notably, Con Edison also carries a high system loss percentage, placing it in the upper-right quadrant of the fairness audit scatter: both inefficient and inequitable in its rate structure."
1507
- ]
1508
- },
1509
- {
1510
- "cell_type": "markdown",
1511
- "id": "8e8ae178",
1512
- "metadata": {},
1513
- "source": [
1514
- "---\n",
1515
- "## 7. Energy Flow Analysis\n",
1516
- "\n",
1517
- "The Sankey diagrams provide operational context for the efficiency metrics computed above. Rather than a single number, they show the *full picture* of where a utility's energy comes from and where it goes. A wide `Losses` band at a utility with high residential prices is the inefficiency–cost story in one image. We can compare the utility-level Sankey against the U.S. national average to understand whether NY's profile is typical or anomalous."
1518
- ]
1519
- },
1520
- {
1521
- "cell_type": "code",
1522
- "execution_count": 8,
1523
- "id": "0ae862c6",
1524
- "metadata": {},
1525
- "outputs": [],
1526
  "source": [
1527
  "# Look at a specific utility's energy usage/flow\n",
1528
  "utility_usage = data_util.get_utility_usage(ny_df.sum(), level=\"State\")\n",
@@ -1536,7 +1159,7 @@
1536
  "\n",
1537
  "us_sankey = plot_util.get_energy_use_sankey_plot(us_energy_flow)\n",
1538
  "\n",
1539
- "# us_sankey.show()"
1540
  ]
1541
  },
1542
  {
@@ -1563,9 +1186,8 @@
1563
  "outputs": [],
1564
  "source": [
1565
  "# Sankey chart with a drop down energy flow for each individual utility\n",
1566
- "utility_sankey_with_dropdown = plot_util.add_utility_dropdown(ny_sankey, df=ny_df)\n",
1567
  "\n",
1568
- "# utility_sankey_with_dropdown.show()"
1569
  ]
1570
  },
1571
  {
@@ -1586,15 +1208,36 @@
1586
  "execution_count": 10,
1587
  "id": "cb116404",
1588
  "metadata": {},
1589
- "outputs": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1590
  "source": [
1591
- "# %pip install kaleido\n",
1592
  "\n",
1593
- "# # Gather all plots and export them as SVGs\n",
1594
- "# plots = [top_variance_table, strip_plot, heatmap,\n",
1595
- "# dual_y_scatter, dumbbell, ny_sankey, us_sankey]\n",
1596
  "\n",
1597
- "# plot_util.export_plots_as_svg(plots)"
1598
  ]
1599
  }
1600
  ],
 
139
  "---\n",
140
  "## 3. Ownership Model Analysis\n",
141
  "\n",
142
+ "Before testing the efficiency hypothesis, we establish baseline pricing distributions by ownership model. This matters because ownership type is a structural variable — investor-owned utilities (IOUs) answer to shareholders and profit motives, while cooperatives and municipals serve member-owners or public ratepayers. If ownership type already explains most of the price variance, an efficiency metrics may be redundant."
143
  ]
144
  },
145
  {
146
  "cell_type": "code",
147
+ "execution_count": 4,
148
  "id": "54f2b308",
149
  "metadata": {},
150
+ "outputs": [],
151
+ "source": [
152
+ "strip_plot = plot_util.get_price_spread_strip_plot(ny_df)\n",
153
+ "\n",
154
+ "# strip_plot.show()"
155
+ ]
156
+ },
157
+ {
158
+ "cell_type": "markdown",
159
+ "id": "42f0d824",
160
+ "metadata": {},
161
+ "source": [
162
+ "---\n",
163
+ "## 4. Correlation Analysis\n",
164
+ "\n",
165
+ "Before building directional charts, we compute a Pearson correlation matrix across all key metrics. This serves two purposes: it quantifies the *strength and direction* of every pairwise relationship, and it surfaces any unexpected correlations that warrant further investigation. A positive correlation between `SystemLossPercentage` and `ResidentialUnitPrice` would support the hypothesis. A negative correlation between `LoadFactor` and `ResidentialUnitPrice` (higher efficiency → lower price) would also support it."
166
+ ]
167
+ },
168
+ {
169
+ "cell_type": "code",
170
+ "execution_count": 5,
171
+ "id": "6e0480c9",
172
+ "metadata": {},
173
+ "outputs": [],
174
+ "source": [
175
+ "# Key metrics: System Loss %, Load Factor', Industrial Revenue %, Price Spread\n",
176
+ "heatmap = plot_util.get_key_metrics_corr_matrix(ny_df)\n",
177
+ "\n",
178
+ "# heatmap.show()"
179
+ ]
180
+ },
181
+ {
182
+ "cell_type": "markdown",
183
+ "id": "0003dd2d",
184
+ "metadata": {},
185
+ "source": [
186
+ "**Interpretation:** The heatmap gives us a first look at which efficiency metrics are most predictive of residential pricing. The strong negative correlation between `LoadFactor` and both `ResidentialUnitPrice` and PriceSpread stands out immediately — it suggests infrastructure utilization is a meaningful driver of what residential customers pay. `SystemLossPercentage` shows a weaker positive relationship, which we'll test directly in the next section."
187
+ ]
188
+ },
189
+ {
190
+ "cell_type": "markdown",
191
+ "id": "c92e34ee",
192
+ "metadata": {},
193
+ "source": [
194
+ "---\n",
195
+ "## 5. Fairness Audit — Efficiency vs. Residential Price\n",
196
+ "\n",
197
+ "This is the central test of the research question, presented as two side-by-side scatter plots sharing a y-axis (residential price). Each plot approaches inefficiency from a different angle:\n",
198
+ "\n",
199
+ "| Plot | X-axis | What it tests |\n",
200
+ "|---|---|---|\n",
201
+ "| Left | `SystemLossPercentage` | Does wasted energy in the grid cost residential customers more? |\n",
202
+ "| Right | `LoadFactor` | Does underutilized infrastructure translate to higher per-MWh costs? |\n",
203
+ "\n",
204
+ "> **Filtering note:** This chart excludes utilities with zero system loss or zero load factor. These edge cases typically represent pass-through entities (pure resellers) or data reporting anomalies — including them would distort the OLS fit."
205
+ ]
206
+ },
207
+ {
208
+ "cell_type": "code",
209
+ "execution_count": 6,
210
+ "id": "de2b920d",
211
+ "metadata": {},
212
+ "outputs": [],
213
+ "source": [
214
+ "# Keep residential utilities that are using energy (instead of ONLY reseale, etc.)\n",
215
+ "residential_lf_sys_loss_df = data_util.get_residential_sys_loss(ny_df)\n",
216
+ "residential_lf_sys_loss_df = data_util.get_residential_load_factor(\n",
217
+ " residential_lf_sys_loss_df).round(2)\n",
218
+ "\n",
219
+ "dual_y_scatter = plot_util.get_fairness_dual_y_scatter_plot(\n",
220
+ " residential_lf_sys_loss_df)\n",
221
+ "\n",
222
+ "# dual_y_scatter.show()"
223
+ ]
224
+ },
225
+ {
226
+ "cell_type": "markdown",
227
+ "id": "ccdd7bc3",
228
+ "metadata": {},
229
+ "source": [
230
+ "**Interpretation:** The results are asymmetric: load factor explains 41.7% of residential price variance (R² = 0.417, p < 0.001), a statistically strong relationship. System loss explains 10.8% (R² = 0.108, p = 0.016) — modest but significant. The core hypothesis holds, but the mechanism differs: it is primarily underutilized infrastructure, not transmission waste, that correlates with higher residential rates in New York's utility landscape."
231
+ ]
232
+ },
233
+ {
234
+ "cell_type": "markdown",
235
+ "id": "c69057f2",
236
+ "metadata": {},
237
+ "source": [
238
+ "---\n",
239
+ "## 6. Rate Disparity — Residential vs. Industrial\n",
240
+ "\n",
241
+ "Even if inefficiency drives prices up overall, the burden may not fall equally. This chart examines the **top 10 utilities by Price Spread** — the gap between what residential and industrial customers pay per MWh. Industrial customers typically negotiate volume discounts — some spread is expected. But when residential customers pay 2–3× the industrial rate at the same utility, it raises questions about whether the rate structure reflects true cost-of-service differences or something else. This chart identifies the specific utilities where that premium is most extreme."
242
+ ]
243
+ },
244
+ {
245
+ "cell_type": "code",
246
+ "execution_count": 7,
247
+ "id": "38d3d584",
248
+ "metadata": {},
249
+ "outputs": [],
250
+ "source": [
251
+ "# Keep utilities that offer both industrial and residential services\n",
252
+ "res_ind_customers_df = data_util.get_customer_utilities(ny_df).round(2)\n",
253
+ "\n",
254
+ "dumbbell = plot_util.get_rate_disparity_dumbbell_plot(res_ind_customers_df)\n",
255
+ "\n",
256
+ "# dumbbell.show()"
257
+ ]
258
+ },
259
+ {
260
+ "cell_type": "markdown",
261
+ "id": "86fe4d1f",
262
+ "metadata": {},
263
+ "source": [
264
+ "**Interpretation:** Con Edison (Consolidated Edison) shows the largest residential–industrial spread in the dataset, charging residential customers roughly $233/MWh against a near-zero industrial rate. Eight of the top ten utilities by spread are investor-owned — consistent with the box plot finding that IOUs exhibit the widest pricing distributions. Notably, Con Edison also carries a high system loss percentage, placing it in the upper-right quadrant of the fairness audit scatter: both inefficient and inequitable in its rate structure."
265
+ ]
266
+ },
267
+ {
268
+ "cell_type": "markdown",
269
+ "id": "8e8ae178",
270
+ "metadata": {},
271
+ "source": [
272
+ "---\n",
273
+ "## 7. Energy Flow Analysis\n",
274
+ "\n",
275
+ "The Sankey diagrams provide operational context for the efficiency metrics computed above. Rather than a single number, they show the *full picture* of where a utility's energy comes from and where it goes. A wide `Losses` band at a utility with high residential prices is the inefficiency–cost story in one image. We can compare the utility-level Sankey against the U.S. national average to understand whether NY's profile is typical or anomalous."
276
+ ]
277
+ },
278
+ {
279
+ "cell_type": "code",
280
+ "execution_count": 8,
281
+ "id": "0ae862c6",
282
+ "metadata": {},
283
  "outputs": [
284
  {
285
  "data": {
 
289
  },
290
  "data": [
291
  {
292
+ "link": {
293
+ "source": [
294
+ 0,
295
+ 1,
296
+ 2,
297
+ 3,
298
+ 3,
299
+ 3,
300
+ 3,
301
+ 3
302
+ ],
303
+ "target": [
304
+ 3,
305
+ 3,
306
+ 3,
307
+ 4,
308
+ 5,
309
+ 6,
310
+ 7,
311
+ 8
312
+ ],
313
+ "value": [
314
+ 38.241995847617716,
315
+ 61.36801867501161,
316
+ 0.3899854773706723,
317
+ 64.90663809625768,
318
+ 31.667357390277083,
319
+ 3.200301490366235,
320
+ 0.17504657881402372,
321
+ 0.05065630657952972
322
+ ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
323
  },
324
+ "node": {
325
+ "color": [
326
+ "rgb(95, 70, 144)",
327
+ "rgb(29, 105, 150)",
328
+ "rgb(56, 166, 165)",
329
+ "rgb(15, 133, 84)",
330
+ "rgb(115, 175, 72)",
331
+ "rgb(237, 173, 8)",
332
+ "rgb(225, 124, 5)",
333
+ "rgb(204, 80, 62)",
334
+ "rgb(148, 52, 110)",
335
+ "rgb(111, 64, 112)",
336
+ "rgb(102, 102, 102)"
337
+ ],
338
+ "label": [
339
+ "Generated",
340
+ "Purchased",
341
+ "Other",
342
+ "Uses",
343
+ "Retail Sales",
344
+ "Resale",
345
+ "Losses",
346
+ "Consumed",
347
+ "No Charge"
348
+ ],
349
+ "line": {
350
+ "color": "black",
351
+ "width": 0.5
352
+ },
353
+ "pad": 15,
354
+ "thickness": 20
355
  },
356
+ "type": "sankey",
357
+ "valueformat": ".1f",
358
+ "valuesuffix": "%"
359
  }
360
  ],
361
  "layout": {
362
+ "hovermode": "x",
 
 
 
 
 
 
 
363
  "template": {
364
  "data": {
365
  "bar": [
 
372
  },
373
  "marker": {
374
  "line": {
375
+ "color": "#E5ECF6",
376
  "width": 0.5
377
  },
378
  "pattern": {
 
388
  {
389
  "marker": {
390
  "line": {
391
+ "color": "#E5ECF6",
392
  "width": 0.5
393
  },
394
  "pattern": {
 
404
  {
405
  "aaxis": {
406
  "endlinecolor": "#2a3f5f",
407
+ "gridcolor": "white",
408
+ "linecolor": "white",
409
+ "minorgridcolor": "white",
410
  "startlinecolor": "#2a3f5f"
411
  },
412
  "baxis": {
413
  "endlinecolor": "#2a3f5f",
414
+ "gridcolor": "white",
415
+ "linecolor": "white",
416
+ "minorgridcolor": "white",
417
  "startlinecolor": "#2a3f5f"
418
  },
419
  "type": "carpet"
 
1030
  "geo": {
1031
  "bgcolor": "white",
1032
  "lakecolor": "white",
1033
+ "landcolor": "#E5ECF6",
1034
  "showlakes": true,
1035
  "showland": true,
1036
+ "subunitcolor": "white"
1037
  },
1038
  "hoverlabel": {
1039
  "align": "left"
 
1043
  "style": "light"
1044
  },
1045
  "paper_bgcolor": "white",
1046
+ "plot_bgcolor": "#E5ECF6",
1047
  "polar": {
1048
  "angularaxis": {
1049
+ "gridcolor": "white",
1050
+ "linecolor": "white",
1051
  "ticks": ""
1052
  },
1053
+ "bgcolor": "#E5ECF6",
1054
  "radialaxis": {
1055
+ "gridcolor": "white",
1056
+ "linecolor": "white",
1057
  "ticks": ""
1058
  }
1059
  },
1060
  "scene": {
1061
  "xaxis": {
1062
+ "backgroundcolor": "#E5ECF6",
1063
+ "gridcolor": "white",
1064
  "gridwidth": 2,
1065
+ "linecolor": "white",
1066
  "showbackground": true,
1067
  "ticks": "",
1068
+ "zerolinecolor": "white"
1069
  },
1070
  "yaxis": {
1071
+ "backgroundcolor": "#E5ECF6",
1072
+ "gridcolor": "white",
1073
  "gridwidth": 2,
1074
+ "linecolor": "white",
1075
  "showbackground": true,
1076
  "ticks": "",
1077
+ "zerolinecolor": "white"
1078
  },
1079
  "zaxis": {
1080
+ "backgroundcolor": "#E5ECF6",
1081
+ "gridcolor": "white",
1082
  "gridwidth": 2,
1083
+ "linecolor": "white",
1084
  "showbackground": true,
1085
  "ticks": "",
1086
+ "zerolinecolor": "white"
1087
  }
1088
  },
1089
  "shapedefaults": {
 
1093
  },
1094
  "ternary": {
1095
  "aaxis": {
1096
+ "gridcolor": "white",
1097
+ "linecolor": "white",
1098
  "ticks": ""
1099
  },
1100
  "baxis": {
1101
+ "gridcolor": "white",
1102
+ "linecolor": "white",
1103
  "ticks": ""
1104
  },
1105
+ "bgcolor": "#E5ECF6",
1106
  "caxis": {
1107
+ "gridcolor": "white",
1108
+ "linecolor": "white",
1109
  "ticks": ""
1110
  }
1111
  },
 
1114
  },
1115
  "xaxis": {
1116
  "automargin": true,
1117
+ "gridcolor": "white",
1118
+ "linecolor": "white",
1119
  "ticks": "",
1120
  "title": {
1121
  "standoff": 15
1122
  },
1123
+ "zerolinecolor": "white",
1124
  "zerolinewidth": 2
1125
  },
1126
  "yaxis": {
1127
  "automargin": true,
1128
+ "gridcolor": "white",
1129
+ "linecolor": "white",
1130
  "ticks": "",
1131
  "title": {
1132
  "standoff": 15
1133
  },
1134
+ "zerolinecolor": "white",
1135
  "zerolinewidth": 2
1136
  }
1137
  }
1138
  },
1139
  "title": {
1140
+ "text": "<b>Energy Flow: </b>United States"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1141
  }
1142
  }
1143
  }
 
1146
  "output_type": "display_data"
1147
  }
1148
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1149
  "source": [
1150
  "# Look at a specific utility's energy usage/flow\n",
1151
  "utility_usage = data_util.get_utility_usage(ny_df.sum(), level=\"State\")\n",
 
1159
  "\n",
1160
  "us_sankey = plot_util.get_energy_use_sankey_plot(us_energy_flow)\n",
1161
  "\n",
1162
+ "us_sankey.show()"
1163
  ]
1164
  },
1165
  {
 
1186
  "outputs": [],
1187
  "source": [
1188
  "# Sankey chart with a drop down energy flow for each individual utility\n",
 
1189
  "\n",
1190
+ "# plot_util.add_utility_dropdown(ny_sankey, df=ny_df)"
1191
  ]
1192
  },
1193
  {
 
1208
  "execution_count": 10,
1209
  "id": "cb116404",
1210
  "metadata": {},
1211
+ "outputs": [
1212
+ {
1213
+ "name": "stdout",
1214
+ "output_type": "stream",
1215
+ "text": [
1216
+ "Defaulting to user installation because normal site-packages is not writeable\n",
1217
+ "Requirement already satisfied: kaleido in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (1.2.0)\n",
1218
+ "Requirement already satisfied: choreographer>=1.1.1 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from kaleido) (1.2.1)\n",
1219
+ "Requirement already satisfied: logistro>=1.0.8 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from kaleido) (2.0.1)\n",
1220
+ "Requirement already satisfied: orjson>=3.10.15 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from kaleido) (3.11.8)\n",
1221
+ "Requirement already satisfied: packaging in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from kaleido) (26.0)\n",
1222
+ "Requirement already satisfied: pytest-timeout>=2.4.0 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from kaleido) (2.4.0)\n",
1223
+ "Requirement already satisfied: simplejson>=3.19.3 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from choreographer>=1.1.1->kaleido) (4.0.1)\n",
1224
+ "Requirement already satisfied: pytest>=7.0.0 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from pytest-timeout>=2.4.0->kaleido) (9.0.3)\n",
1225
+ "Requirement already satisfied: colorama>=0.4 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from pytest>=7.0.0->pytest-timeout>=2.4.0->kaleido) (0.4.6)\n",
1226
+ "Requirement already satisfied: iniconfig>=1.0.1 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from pytest>=7.0.0->pytest-timeout>=2.4.0->kaleido) (2.3.0)\n",
1227
+ "Requirement already satisfied: pluggy<2,>=1.5 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from pytest>=7.0.0->pytest-timeout>=2.4.0->kaleido) (1.6.0)\n",
1228
+ "Requirement already satisfied: pygments>=2.7.2 in C:\\Users\\chals\\AppData\\Roaming\\Python\\Python313\\site-packages (from pytest>=7.0.0->pytest-timeout>=2.4.0->kaleido) (2.19.2)\n",
1229
+ "Note: you may need to restart the kernel to use updated packages.\n"
1230
+ ]
1231
+ }
1232
+ ],
1233
  "source": [
1234
+ "%pip install kaleido\n",
1235
  "\n",
1236
+ "# Gather all plots and export them as SVGs\n",
1237
+ "plots = [top_variance_table, strip_plot, heatmap,\n",
1238
+ " dual_y_scatter, dumbbell, ny_sankey, us_sankey]\n",
1239
  "\n",
1240
+ "plot_util.export_plots_as_svg(plots)"
1241
  ]
1242
  }
1243
  ],