File size: 31,369 Bytes
3442d3e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from datetime import timedelta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\nCould you make a Google drive with a giant excel sheet with many tabs. Here are tabs needed (I added columns name in \" \", some are quite long):\\n\\n•\\t\"Hardware mentions\" (which should have 14,530 rows right?): \\no\\tColumn 1: \"Date mentioned\"\\no\\tColumn 2: \"Link to the thread\" (if you have, otherwise no need of this column\\no\\tColumn 3: \"Hardware name\" (put the after-mapping name for consistency)\\no\\tColumn 3: \"Power efficiency (TH/J)\"\\no\\tColumn 4: \"Release date\" (so that\\'s not the date it was mentioned, but the date the hardware company released it)\\n'"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"\n",
    "Could you make a Google drive with a giant excel sheet with many tabs. Here are tabs needed (I added columns name in \" \", some are quite long):\n",
    "\n",
    "•\t\"Hardware mentions\" (which should have 14,530 rows right?): \n",
    "o\tColumn 1: \"Date mentioned\"\n",
    "o\tColumn 2: \"Link to the thread\" (if you have, otherwise no need of this column\n",
    "o\tColumn 3: \"Hardware name\" (put the after-mapping name for consistency)\n",
    "o\tColumn 3: \"Power efficiency (TH/J)\"\n",
    "o\tColumn 4: \"Release date\" (so that's not the date it was mentioned, but the date the hardware company released it)\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Date mentioned</th>\n",
       "      <th>Hardware name</th>\n",
       "      <th>Power efficiency (TH/J)</th>\n",
       "      <th>Release date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2010-09-09 12:59:39</td>\n",
       "      <td>gtx460</td>\n",
       "      <td>4.270000e-07</td>\n",
       "      <td>Jul 2010</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2010-10-06 20:25:17</td>\n",
       "      <td>4350</td>\n",
       "      <td>3.460000e-07</td>\n",
       "      <td>Jan 2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2010-10-06 20:25:17</td>\n",
       "      <td>5770</td>\n",
       "      <td>1.940100e-06</td>\n",
       "      <td>Oct 2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2010-10-06 20:25:17</td>\n",
       "      <td>5870</td>\n",
       "      <td>1.906000e-06</td>\n",
       "      <td>Sep 2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2010-10-06 20:25:17</td>\n",
       "      <td>gtx260</td>\n",
       "      <td>2.100000e-07</td>\n",
       "      <td>Dec 2009</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14530</th>\n",
       "      <td>2023-12-17 03:45:25</td>\n",
       "      <td>microbt whatsminer m30s</td>\n",
       "      <td>2.631579e-02</td>\n",
       "      <td>Apr 2020</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14531</th>\n",
       "      <td>2023-12-17 03:45:25</td>\n",
       "      <td>microbt whatsminer m50s</td>\n",
       "      <td>3.846100e-02</td>\n",
       "      <td>Jul 2022</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14532</th>\n",
       "      <td>2023-12-17 03:45:25</td>\n",
       "      <td>microbt whatsminer m50s</td>\n",
       "      <td>3.846100e-02</td>\n",
       "      <td>Jul 2022</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14533</th>\n",
       "      <td>2023-12-17 03:45:25</td>\n",
       "      <td>microbt whatsminer m50s</td>\n",
       "      <td>3.846100e-02</td>\n",
       "      <td>Jul 2022</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14534</th>\n",
       "      <td>2023-12-17 03:45:25</td>\n",
       "      <td>microbt whatsminer m50s</td>\n",
       "      <td>3.846100e-02</td>\n",
       "      <td>Jul 2022</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>14535 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            Date mentioned            Hardware name  Power efficiency (TH/J)  \\\n",
       "0      2010-09-09 12:59:39                   gtx460             4.270000e-07   \n",
       "1      2010-10-06 20:25:17                     4350             3.460000e-07   \n",
       "2      2010-10-06 20:25:17                     5770             1.940100e-06   \n",
       "3      2010-10-06 20:25:17                     5870             1.906000e-06   \n",
       "4      2010-10-06 20:25:17                   gtx260             2.100000e-07   \n",
       "...                    ...                      ...                      ...   \n",
       "14530  2023-12-17 03:45:25  microbt whatsminer m30s             2.631579e-02   \n",
       "14531  2023-12-17 03:45:25  microbt whatsminer m50s             3.846100e-02   \n",
       "14532  2023-12-17 03:45:25  microbt whatsminer m50s             3.846100e-02   \n",
       "14533  2023-12-17 03:45:25  microbt whatsminer m50s             3.846100e-02   \n",
       "14534  2023-12-17 03:45:25  microbt whatsminer m50s             3.846100e-02   \n",
       "\n",
       "      Release date  \n",
       "0         Jul 2010  \n",
       "1         Jan 2009  \n",
       "2         Oct 2009  \n",
       "3         Sep 2009  \n",
       "4         Dec 2009  \n",
       "...            ...  \n",
       "14530     Apr 2020  \n",
       "14531     Jul 2022  \n",
       "14532     Jul 2022  \n",
       "14533     Jul 2022  \n",
       "14534     Jul 2022  \n",
       "\n",
       "[14535 rows x 4 columns]"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# date,hardware_name,TH/J\n",
    "# 2010-09-09 12:59:39,gtx460,0.0000004270\n",
    "hardware = pd.read_csv(\"../bitcoinforum/5_processing_extracted_data/hardware_instances_with_efficiency.csv\")\n",
    "hardware.rename(columns={\"date\": \"Date mentioned\", \"hardware_name\": \"Hardware name\", \"TH/J\": \"Power efficiency (TH/J)\"}, inplace=True)\n",
    "\n",
    "# \\#,Type,Hardware name,Release date,First date used,Eff. (TH/J)\n",
    "# 1,GPU,8800gts,Feb 2007,2011-03-08,1.09E-07\n",
    "paper_list = pd.read_csv(\"../hardwarelist/paper_list.csv\")\n",
    "paper_list[\"Hardware name\"] = paper_list[\"Hardware name\"].str.lower()\n",
    "\n",
    "# Merge on hardware name to get the release date\n",
    "df1 = hardware.merge(paper_list[[\"Hardware name\", \"Release date\"]], on=\"Hardware name\", how=\"left\")\n",
    "df1.to_csv(\"csv/Hardware mentions.csv\", index=False)\n",
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n•\\t\"Hardware count by year\" \\no\\tHere you just remake tab S20\\n'"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"\n",
    "•\t\"Hardware count by year\" \n",
    "o\tHere you just remake tab S20\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Year</th>\n",
       "      <th>Count</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2011</td>\n",
       "      <td>1147</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2012</td>\n",
       "      <td>803</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2013</td>\n",
       "      <td>2001</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2014</td>\n",
       "      <td>2379</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>2015</td>\n",
       "      <td>1899</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>2016</td>\n",
       "      <td>1320</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>2017</td>\n",
       "      <td>1569</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>2018</td>\n",
       "      <td>1160</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2019</td>\n",
       "      <td>575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>2020</td>\n",
       "      <td>363</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>2021</td>\n",
       "      <td>644</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>2022</td>\n",
       "      <td>422</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>2023</td>\n",
       "      <td>246</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    Year  Count\n",
       "1   2011   1147\n",
       "2   2012    803\n",
       "3   2013   2001\n",
       "4   2014   2379\n",
       "5   2015   1899\n",
       "6   2016   1320\n",
       "7   2017   1569\n",
       "8   2018   1160\n",
       "9   2019    575\n",
       "10  2020    363\n",
       "11  2021    644\n",
       "12  2022    422\n",
       "13  2023    246"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2 = df1[[\"Date mentioned\"]].copy()\n",
    "df2[\"Date mentioned\"] = df2[\"Date mentioned\"].apply(lambda x: x[:4])\n",
    "df2 = df2.groupby(\"Date mentioned\").size().reset_index(name=\"Count\")\n",
    "df2.rename(columns={\"Date mentioned\": \"Year\"}, inplace=True)\n",
    "# remove 2010\n",
    "df2 = df2[df2[\"Year\"] != \"2010\"]\n",
    "df2.to_csv(\"csv/Hardware count by year.csv\", index=False)\n",
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n•\\t\"Power efficiency\" \\no\\tColumn 1: \"Quarter\" (I guess you did quarterly, so you can write like Q1 2011, Q2 2011....)\\no\\tColumn 2: \"Average power efficiency (TH/J)\" (here you put the average we calculated for each quarter)\\no\\tColumn 3: \"Max attainable power efficiency (TH/J)\" (here you put Pmax value for each quarter, you can put the Pmax value you have for each quarter beginning)\\n'"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"\n",
    "•\t\"Power efficiency\" \n",
    "o\tColumn 1: \"Quarter\" (I guess you did quarterly, so you can write like Q1 2011, Q2 2011....)\n",
    "o\tColumn 2: \"Average power efficiency (TH/J)\" (here you put the average we calculated for each quarter)\n",
    "o\tColumn 3: \"Max attainable power efficiency (TH/J)\" (here you put Pmax value for each quarter, you can put the Pmax value you have for each quarter beginning)\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Quarter</th>\n",
       "      <th>Average power efficiency (TH/J)</th>\n",
       "      <th>Max attainable power efficiency (TH/J)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2011Q1</td>\n",
       "      <td>1.676753e+06</td>\n",
       "      <td>3780000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2011Q2</td>\n",
       "      <td>1.662901e+06</td>\n",
       "      <td>3780000.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2011Q3</td>\n",
       "      <td>1.777678e+06</td>\n",
       "      <td>23300000.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Quarter  Average power efficiency (TH/J)  \\\n",
       "0  2011Q1                     1.676753e+06   \n",
       "1  2011Q2                     1.662901e+06   \n",
       "2  2011Q3                     1.777678e+06   \n",
       "\n",
       "   Max attainable power efficiency (TH/J)  \n",
       "0                               3780000.0  \n",
       "1                               3780000.0  \n",
       "2                              23300000.0  "
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# date,price,hashrate,coins_per_block,efficiency,max_efficiency\n",
    "# 2023-12-31,38658.06,5.008642376892796e+20,6.25,34412596500.0,54100000000.0\n",
    "monthly_stuff = pd.read_csv(\"../bitcoinforum/6_merging/monthly_stuff.csv\")\n",
    "monthly_stuff[\"date\"] = pd.to_datetime(monthly_stuff[\"date\"])\n",
    "monthly_stuff[\"Quarter\"] = monthly_stuff[\"date\"].dt.to_period(\"Q\")\n",
    "monthly_stuff[\"Quarter\"] = monthly_stuff[\"Quarter\"].astype(str)\n",
    "monthly_stuff = monthly_stuff[[\"Quarter\", \"efficiency\", \"max_efficiency\"]]\n",
    "df3 = monthly_stuff.groupby(\"Quarter\").agg({\"efficiency\": \"mean\", \"max_efficiency\": \"first\"}).reset_index()\n",
    "df3.rename(columns={\"efficiency\": \"Average power efficiency (TH/J)\", \"max_efficiency\": \"Max attainable power efficiency (TH/J)\"}, inplace=True)\n",
    "df3.to_csv(\"csv/Power efficiency.csv\", index=False)\n",
    "df3.head(3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n•\\t\"Electricity consumption and carbon footprint\"\\no\\tHere you just remake Tab S18\\n'"
      ]
     },
     "execution_count": 54,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"\n",
    "•\t\"Electricity consumption and carbon footprint\"\n",
    "o\tHere you just remake Tab S18\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [],
   "source": [
    "# the file is exported by plots/main.ipynb"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'\\n•\\t\"Bitcoin price and mining costs\" \\no\\tColumn 1: \"Bitcoin price\" each row is a day since Jan 2011, and you put the price everyday until end of December 2023\\no\\tColumn 2: \"Mining costs with C = 0.03 USD/kWh; PUE = 1.0\"\\no\\tColumn 3: \"Mining costs with C = 0.05 USD/kWh; PUE = 1.1\"\\no\\tColumn 4: \"Mining costs with C = 0.07 USD/kWh; PUE = 1.2\"\\no\\tColumn 5: \"Price-cost price with C = 0.03 USD/kWh; PUE = 1.0\"\\no\\tColumn 6: \"Price-cost price with C = 0.05 USD/kWh; PUE = 1.1\"\\no\\tColumn 7: \"Price-cost price with C = 0.07 USD/kWh; PUE = 1.2\"\\n'"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\"\"\"\n",
    "•\t\"Bitcoin price and mining costs\" \n",
    "o\tColumn 1: \"Bitcoin price\" each row is a day since Jan 2011, and you put the price everyday until end of December 2023\n",
    "o\tColumn 2: \"Mining costs with C = 0.03 USD/kWh; PUE = 1.0\"\n",
    "o\tColumn 3: \"Mining costs with C = 0.05 USD/kWh; PUE = 1.1\"\n",
    "o\tColumn 4: \"Mining costs with C = 0.07 USD/kWh; PUE = 1.2\"\n",
    "o\tColumn 5: \"Price-cost ratio with C = 0.03 USD/kWh; PUE = 1.0\"\n",
    "o\tColumn 6: \"Price-cost ratio with C = 0.05 USD/kWh; PUE = 1.1\"\n",
    "o\tColumn 7: \"Price-cost ratio with C = 0.07 USD/kWh; PUE = 1.2\"\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>date</th>\n",
       "      <th>Bitcoin price</th>\n",
       "      <th>Mining costs with C = 0.03 USD/kWh; PUE = 1.0</th>\n",
       "      <th>Mining costs with C = 0.05 USD/kWh; PUE = 1.1</th>\n",
       "      <th>Mining costs with C = 0.07 USD/kWh; PUE = 1.2</th>\n",
       "      <th>Price-cost ratio with C = 0.03 USD/kWh; PUE = 1.0</th>\n",
       "      <th>Price-cost ratio with C = 0.05 USD/kWh; PUE = 1.1</th>\n",
       "      <th>Price-cost ratio with C = 0.07 USD/kWh; PUE = 1.2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2023-12-31</td>\n",
       "      <td>38658.0600</td>\n",
       "      <td>11643.741853</td>\n",
       "      <td>21346.860065</td>\n",
       "      <td>32602.477190</td>\n",
       "      <td>3.320072</td>\n",
       "      <td>1.810948</td>\n",
       "      <td>1.185740</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2023-10-31</td>\n",
       "      <td>27978.1000</td>\n",
       "      <td>14776.112668</td>\n",
       "      <td>27089.539892</td>\n",
       "      <td>41373.115471</td>\n",
       "      <td>1.893468</td>\n",
       "      <td>1.032801</td>\n",
       "      <td>0.676239</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2023-09-30</td>\n",
       "      <td>25816.5700</td>\n",
       "      <td>14485.653053</td>\n",
       "      <td>26557.030597</td>\n",
       "      <td>40559.828548</td>\n",
       "      <td>1.782217</td>\n",
       "      <td>0.972118</td>\n",
       "      <td>0.636506</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2023-08-31</td>\n",
       "      <td>29629.2400</td>\n",
       "      <td>16929.701012</td>\n",
       "      <td>31037.785189</td>\n",
       "      <td>47403.162835</td>\n",
       "      <td>1.750134</td>\n",
       "      <td>0.954618</td>\n",
       "      <td>0.625048</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2023-07-31</td>\n",
       "      <td>30589.0500</td>\n",
       "      <td>16393.181084</td>\n",
       "      <td>30054.165320</td>\n",
       "      <td>45900.907034</td>\n",
       "      <td>1.865962</td>\n",
       "      <td>1.017797</td>\n",
       "      <td>0.666415</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>149</th>\n",
       "      <td>2011-06-30</td>\n",
       "      <td>9.5700</td>\n",
       "      <td>0.465775</td>\n",
       "      <td>0.853920</td>\n",
       "      <td>1.304169</td>\n",
       "      <td>20.546422</td>\n",
       "      <td>11.207139</td>\n",
       "      <td>7.338008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>150</th>\n",
       "      <td>2011-05-31</td>\n",
       "      <td>3.0331</td>\n",
       "      <td>0.138976</td>\n",
       "      <td>0.254789</td>\n",
       "      <td>0.389133</td>\n",
       "      <td>21.824638</td>\n",
       "      <td>11.904348</td>\n",
       "      <td>7.794514</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>151</th>\n",
       "      <td>2011-04-30</td>\n",
       "      <td>0.7741</td>\n",
       "      <td>0.042495</td>\n",
       "      <td>0.077908</td>\n",
       "      <td>0.118987</td>\n",
       "      <td>18.216109</td>\n",
       "      <td>9.936059</td>\n",
       "      <td>6.505753</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>152</th>\n",
       "      <td>2011-03-31</td>\n",
       "      <td>0.9202</td>\n",
       "      <td>0.037427</td>\n",
       "      <td>0.068616</td>\n",
       "      <td>0.104795</td>\n",
       "      <td>24.586600</td>\n",
       "      <td>13.410872</td>\n",
       "      <td>8.780928</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>153</th>\n",
       "      <td>2011-02-28</td>\n",
       "      <td>0.7000</td>\n",
       "      <td>0.016507</td>\n",
       "      <td>0.030262</td>\n",
       "      <td>0.046219</td>\n",
       "      <td>42.406753</td>\n",
       "      <td>23.130956</td>\n",
       "      <td>15.145269</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>154 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "           date  Bitcoin price  Mining costs with C = 0.03 USD/kWh; PUE = 1.0  \\\n",
       "0    2023-12-31     38658.0600                                   11643.741853   \n",
       "1    2023-10-31     27978.1000                                   14776.112668   \n",
       "2    2023-09-30     25816.5700                                   14485.653053   \n",
       "3    2023-08-31     29629.2400                                   16929.701012   \n",
       "4    2023-07-31     30589.0500                                   16393.181084   \n",
       "..          ...            ...                                            ...   \n",
       "149  2011-06-30         9.5700                                       0.465775   \n",
       "150  2011-05-31         3.0331                                       0.138976   \n",
       "151  2011-04-30         0.7741                                       0.042495   \n",
       "152  2011-03-31         0.9202                                       0.037427   \n",
       "153  2011-02-28         0.7000                                       0.016507   \n",
       "\n",
       "     Mining costs with C = 0.05 USD/kWh; PUE = 1.1  \\\n",
       "0                                     21346.860065   \n",
       "1                                     27089.539892   \n",
       "2                                     26557.030597   \n",
       "3                                     31037.785189   \n",
       "4                                     30054.165320   \n",
       "..                                             ...   \n",
       "149                                       0.853920   \n",
       "150                                       0.254789   \n",
       "151                                       0.077908   \n",
       "152                                       0.068616   \n",
       "153                                       0.030262   \n",
       "\n",
       "     Mining costs with C = 0.07 USD/kWh; PUE = 1.2  \\\n",
       "0                                     32602.477190   \n",
       "1                                     41373.115471   \n",
       "2                                     40559.828548   \n",
       "3                                     47403.162835   \n",
       "4                                     45900.907034   \n",
       "..                                             ...   \n",
       "149                                       1.304169   \n",
       "150                                       0.389133   \n",
       "151                                       0.118987   \n",
       "152                                       0.104795   \n",
       "153                                       0.046219   \n",
       "\n",
       "     Price-cost ratio with C = 0.03 USD/kWh; PUE = 1.0  \\\n",
       "0                                             3.320072   \n",
       "1                                             1.893468   \n",
       "2                                             1.782217   \n",
       "3                                             1.750134   \n",
       "4                                             1.865962   \n",
       "..                                                 ...   \n",
       "149                                          20.546422   \n",
       "150                                          21.824638   \n",
       "151                                          18.216109   \n",
       "152                                          24.586600   \n",
       "153                                          42.406753   \n",
       "\n",
       "     Price-cost ratio with C = 0.05 USD/kWh; PUE = 1.1  \\\n",
       "0                                             1.810948   \n",
       "1                                             1.032801   \n",
       "2                                             0.972118   \n",
       "3                                             0.954618   \n",
       "4                                             1.017797   \n",
       "..                                                 ...   \n",
       "149                                          11.207139   \n",
       "150                                          11.904348   \n",
       "151                                           9.936059   \n",
       "152                                          13.410872   \n",
       "153                                          23.130956   \n",
       "\n",
       "     Price-cost ratio with C = 0.07 USD/kWh; PUE = 1.2  \n",
       "0                                             1.185740  \n",
       "1                                             0.676239  \n",
       "2                                             0.636506  \n",
       "3                                             0.625048  \n",
       "4                                             0.666415  \n",
       "..                                                 ...  \n",
       "149                                           7.338008  \n",
       "150                                           7.794514  \n",
       "151                                           6.505753  \n",
       "152                                           8.780928  \n",
       "153                                          15.145269  \n",
       "\n",
       "[154 rows x 8 columns]"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# date,joules_per_coin\n",
    "# 2023-12-31,1397249022408.723\n",
    "joules_per_coin = pd.read_csv(\"joules_per_coin.csv\") # exported by plots/main.ipynb\n",
    "monthly_stuff = pd.read_csv(\"../bitcoinforum/6_merging/monthly_stuff.csv\")\n",
    "price = monthly_stuff[[\"date\", \"price\"]].copy()\n",
    "\n",
    "df4 = price.merge(joules_per_coin, on=\"date\", how=\"left\")\n",
    "df4[\"kwh_per_coin\"] = df4[\"joules_per_coin\"] / 3600000\n",
    "df4[\"Mining costs with C = 0.03 USD/kWh; PUE = 1.0\"] = df4[\"kwh_per_coin\"] * 0.03\n",
    "df4[\"Mining costs with C = 0.05 USD/kWh; PUE = 1.1\"] = df4[\"kwh_per_coin\"] * 0.05 * 1.1\n",
    "df4[\"Mining costs with C = 0.07 USD/kWh; PUE = 1.2\"] = df4[\"kwh_per_coin\"] * 0.07 * 1.2\n",
    "df4[\"Price-cost ratio with C = 0.03 USD/kWh; PUE = 1.0\"] = df4[\"price\"] / df4[\"Mining costs with C = 0.03 USD/kWh; PUE = 1.0\"]\n",
    "df4[\"Price-cost ratio with C = 0.05 USD/kWh; PUE = 1.1\"] = df4[\"price\"] / df4[\"Mining costs with C = 0.05 USD/kWh; PUE = 1.1\"]\n",
    "df4[\"Price-cost ratio with C = 0.07 USD/kWh; PUE = 1.2\"] = df4[\"price\"] / df4[\"Mining costs with C = 0.07 USD/kWh; PUE = 1.2\"]\n",
    "df4.rename(columns={\"price\": \"Bitcoin price\"}, inplace=True)\n",
    "df4.drop(columns=[\"joules_per_coin\", \"kwh_per_coin\"], inplace=True)\n",
    "df4.to_csv(\"csv/Bitcoin price and mining costs.csv\", index=False)\n",
    "df4"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py310",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.13"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}