@@ -186,7 +186,8 @@ class _HtmlFrameParser:
186
186
187
187
extract_links : {None, "all", "header", "body", "footer"}
188
188
Table elements in the specified section(s) with <a> tags will have their
189
- href extracted.
189
+ href extracted. Note that specifying "header" will result in a
190
+ :class:`~pandas.MultiIndex`.
190
191
191
192
.. versionadded:: 1.5.0
192
193
@@ -210,7 +211,8 @@ class _HtmlFrameParser:
210
211
211
212
extract_links : {None, "all", "header", "body", "footer"}
212
213
Table elements in the specified section(s) with <a> tags will have their
213
- href extracted.
214
+ href extracted. Note that specifying "header" will result in a
215
+ :class:`~pandas.MultiIndex`.
214
216
215
217
.. versionadded:: 1.5.0
216
218
@@ -1005,9 +1007,7 @@ def _parse(flavor, io, match, attrs, encoding, displayed_only, extract_links, **
1005
1007
for table in tables :
1006
1008
try :
1007
1009
df = _data_to_frame (data = table , ** kwargs )
1008
- # Cast MultiIndex header to an Index of tuples when extracting header
1009
- # links and replace np.nan with None.
1010
- # This maintains consistency of selection (e.g. df.columns.str[1])
1010
+ # Replace nan with None for null header links for consistency throughout df.
1011
1011
if extract_links in ("all" , "header" ):
1012
1012
idx = df .columns .values
1013
1013
idx [:] = np .vectorize (
@@ -1136,7 +1136,8 @@ def read_html(
1136
1136
1137
1137
extract_links : {None, "all", "header", "body", "footer"}
1138
1138
Table elements in the specified section(s) with <a> tags will have their
1139
- href extracted.
1139
+ href extracted. Note that specifying "header" will result in a
1140
+ :class:`~pandas.MultiIndex`.
1140
1141
1141
1142
.. versionadded:: 1.5.0
1142
1143
0 commit comments