File size: 8,728 Bytes
884a52f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# don't run this again it will overwrite the csv"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "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>Author</th>\n",
       "      <th>Publication date</th>\n",
       "      <th>Title</th>\n",
       "      <th>Estimate (TWh)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Digiconomist</td>\n",
       "      <td>Live estimate</td>\n",
       "      <td>Bitcoin Energy Consumption Index</td>\n",
       "      <td>{insert API}</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>CoinMetrics</td>\n",
       "      <td>June 2023</td>\n",
       "      <td>The Signal &amp; The Nonce</td>\n",
       "      <td>117.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>De Vries, A., Gallersdorfer, U., Klaaßen, L. ...</td>\n",
       "      <td>February 2022</td>\n",
       "      <td>Revisiting Bitcoin's carbon footprint</td>\n",
       "      <td>117.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>CoinShares</td>\n",
       "      <td>January 2022</td>\n",
       "      <td>The Bitcoin Mining Network</td>\n",
       "      <td>89.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Sandner, P., Lichti, C., Richter, R., Heidt, C...</td>\n",
       "      <td>August 2021</td>\n",
       "      <td>The Carbon Emissions of Bitcoin From an Invest...</td>\n",
       "      <td>90.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>Köhler, S. and Pizzol, M.</td>\n",
       "      <td>November 2019</td>\n",
       "      <td>Life Cycle Assessment of Bitcoin Mining</td>\n",
       "      <td>31.3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>Stoll, C., Klaaßen, L. and Gallersdorfer, U.</td>\n",
       "      <td>June 2019</td>\n",
       "      <td>The Carbon Footprint of Bitcoin</td>\n",
       "      <td>48.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>Zade, M., Myklebost, J., Tzscheutschler, P. an...</td>\n",
       "      <td>March 2019</td>\n",
       "      <td>Is Bitcoin the Only Problem? A Scenario Model ...</td>\n",
       "      <td>33.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>Krause, M.J. and Tolaymat, T.</td>\n",
       "      <td>November 2018</td>\n",
       "      <td>Quantification of energy and carbon costs for ...</td>\n",
       "      <td>30.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>McCook, H.</td>\n",
       "      <td>August 2018</td>\n",
       "      <td>The cost &amp; sustainability of Bitcoin</td>\n",
       "      <td>105.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>De Vries, A.</td>\n",
       "      <td>May 2018</td>\n",
       "      <td>Bitcoin's Growing Energy Problem</td>\n",
       "      <td>22.4 to 67.2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Vranken, H.</td>\n",
       "      <td>October 2017</td>\n",
       "      <td>Sustainability of bitcoin and blockchains</td>\n",
       "      <td>0.9 to 4.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>Bevand, M.</td>\n",
       "      <td>February 2017</td>\n",
       "      <td>Electricity consumption of Bitcoin: a market-b...</td>\n",
       "      <td>4.1 to 4.7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>Hayes, A.S.</td>\n",
       "      <td>March 2015</td>\n",
       "      <td>A Cost Production Model for Bitcoin</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>O'Dwyer, K.L. and Malone, D.</td>\n",
       "      <td>September 2014</td>\n",
       "      <td>Bitcoin Mining and its Energy Footprint</td>\n",
       "      <td>0.9 to 87.6</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               Author Publication date  \\\n",
       "0                                        Digiconomist    Live estimate   \n",
       "1                                         CoinMetrics        June 2023   \n",
       "2   De Vries, A., Gallersdorfer, U., Klaaßen, L. ...    February 2022   \n",
       "3                                          CoinShares     January 2022   \n",
       "4   Sandner, P., Lichti, C., Richter, R., Heidt, C...      August 2021   \n",
       "5                          Köhler, S. and Pizzol, M.    November 2019   \n",
       "6       Stoll, C., Klaaßen, L. and Gallersdorfer, U.        June 2019   \n",
       "7   Zade, M., Myklebost, J., Tzscheutschler, P. an...       March 2019   \n",
       "8                       Krause, M.J. and Tolaymat, T.    November 2018   \n",
       "9                                          McCook, H.      August 2018   \n",
       "10                                       De Vries, A.         May 2018   \n",
       "11                                        Vranken, H.     October 2017   \n",
       "12                                         Bevand, M.    February 2017   \n",
       "13                                        Hayes, A.S.       March 2015   \n",
       "14                       O'Dwyer, K.L. and Malone, D.   September 2014   \n",
       "\n",
       "                                                Title Estimate (TWh)  \n",
       "0                    Bitcoin Energy Consumption Index   {insert API}  \n",
       "1                              The Signal & The Nonce          117.4  \n",
       "2               Revisiting Bitcoin's carbon footprint          117.3  \n",
       "3                          The Bitcoin Mining Network           89.0  \n",
       "4   The Carbon Emissions of Bitcoin From an Invest...           90.9  \n",
       "5             Life Cycle Assessment of Bitcoin Mining           31.3  \n",
       "6                     The Carbon Footprint of Bitcoin           48.5  \n",
       "7   Is Bitcoin the Only Problem? A Scenario Model ...           33.7  \n",
       "8   Quantification of energy and carbon costs for ...           30.1  \n",
       "9                The cost & sustainability of Bitcoin          105.0  \n",
       "10                   Bitcoin's Growing Energy Problem   22.4 to 67.2  \n",
       "11          Sustainability of bitcoin and blockchains     0.9 to 4.4  \n",
       "12  Electricity consumption of Bitcoin: a market-b...     4.1 to 4.7  \n",
       "13                A Cost Production Model for Bitcoin            NaN  \n",
       "14            Bitcoin Mining and its Energy Footprint    0.9 to 87.6  "
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "intensity_file = \"table.html\"\n",
    "# read the html file using the first row as header\n",
    "dfs = pd.read_html(intensity_file, header=0)\n",
    "\n",
    "# Access the second table (index 1)\n",
    "df = dfs[0]\n",
    "df.to_csv(\"table.csv\", index=False)\n",
    "df"
   ]
  }
 ],
 "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
}