Skip to content

Commit 0c07ab2

Browse files
gfyoungjreback
authored andcommitted
DEPR: Deprecate skip_footer in read_excel (#18836)
1 parent 6708db0 commit 0c07ab2

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

doc/source/whatsnew/v0.22.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ Deprecations
212212
that is the actual tuple, instead of treating the tuple as multiple keys. To
213213
retain the previous behavior, use a list instead of a tuple (:issue:`18314`)
214214
- ``Series.valid`` is deprecated. Use :meth:`Series.dropna` instead (:issue:`18800`).
215+
- :func:`read_excel` has deprecated the ``skip_footer`` parameter. Use ``skipfooter`` instead (:issue:`18836`)
215216

216217
.. _whatsnew_0220.prior_deprecations:
217218

pandas/io/excel.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@
149149
any numeric columns will automatically be parsed, regardless of display
150150
format.
151151
skip_footer : int, default 0
152+
153+
.. deprecated:: 0.22.0
154+
Pass in `skipfooter` instead.
155+
skipfooter : int, default 0
152156
Rows at the end to skip (0-indexed)
153157
convert_float : boolean, default True
154158
convert integral floats to int (i.e., 1.0 --> 1). If False, all numeric
@@ -200,6 +204,7 @@ def get_writer(engine_name):
200204

201205
@Appender(_read_excel_doc)
202206
@deprecate_kwarg("parse_cols", "usecols")
207+
@deprecate_kwarg("skip_footer", "skipfooter")
203208
def read_excel(io,
204209
sheet_name=0,
205210
header=0,
@@ -218,7 +223,7 @@ def read_excel(io,
218223
parse_dates=False,
219224
date_parser=None,
220225
thousands=None,
221-
skip_footer=0,
226+
skipfooter=0,
222227
convert_float=True,
223228
**kwds):
224229

@@ -251,7 +256,7 @@ def read_excel(io,
251256
parse_dates=parse_dates,
252257
date_parser=date_parser,
253258
thousands=thousands,
254-
skip_footer=skip_footer,
259+
skipfooter=skipfooter,
255260
convert_float=convert_float,
256261
**kwds)
257262

@@ -333,7 +338,7 @@ def parse(self,
333338
parse_dates=False,
334339
date_parser=None,
335340
thousands=None,
336-
skip_footer=0,
341+
skipfooter=0,
337342
convert_float=True,
338343
**kwds):
339344
"""
@@ -358,7 +363,7 @@ def parse(self,
358363
parse_dates=parse_dates,
359364
date_parser=date_parser,
360365
thousands=thousands,
361-
skip_footer=skip_footer,
366+
skipfooter=skipfooter,
362367
convert_float=convert_float,
363368
**kwds)
364369

@@ -412,14 +417,10 @@ def _parse_excel(self,
412417
parse_dates=False,
413418
date_parser=None,
414419
thousands=None,
415-
skip_footer=0,
420+
skipfooter=0,
416421
convert_float=True,
417422
**kwds):
418423

419-
skipfooter = kwds.pop('skipfooter', None)
420-
if skipfooter is not None:
421-
skip_footer = skipfooter
422-
423424
_validate_header_arg(header)
424425

425426
if 'chunksize' in kwds:
@@ -590,7 +591,7 @@ def _parse_cell(cell_contents, cell_typ):
590591
parse_dates=parse_dates,
591592
date_parser=date_parser,
592593
thousands=thousands,
593-
skipfooter=skip_footer,
594+
skipfooter=skipfooter,
594595
**kwds)
595596

596597
output[asheetname] = parser.read(nrows=nrows)

pandas/tests/io/test_excel.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,14 @@ def test_excel_table_sheet_by_index(self):
286286
tm.assert_frame_equal(df2, dfref, check_names=False)
287287

288288
df3 = read_excel(excel, 0, index_col=0, skipfooter=1)
289-
df4 = read_excel(excel, 0, index_col=0, skip_footer=1)
290289
tm.assert_frame_equal(df3, df1.iloc[:-1])
291-
tm.assert_frame_equal(df3, df4)
290+
291+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
292+
df4 = read_excel(excel, 0, index_col=0, skip_footer=1)
293+
tm.assert_frame_equal(df3, df4)
292294

293295
df3 = excel.parse(0, index_col=0, skipfooter=1)
294-
df4 = excel.parse(0, index_col=0, skip_footer=1)
295296
tm.assert_frame_equal(df3, df1.iloc[:-1])
296-
tm.assert_frame_equal(df3, df4)
297297

298298
import xlrd
299299
with pytest.raises(xlrd.XLRDError):
@@ -311,10 +311,7 @@ def test_excel_table(self):
311311

312312
df3 = self.get_exceldf('test1', 'Sheet1', index_col=0,
313313
skipfooter=1)
314-
df4 = self.get_exceldf('test1', 'Sheet1', index_col=0,
315-
skip_footer=1)
316314
tm.assert_frame_equal(df3, df1.iloc[:-1])
317-
tm.assert_frame_equal(df3, df4)
318315

319316
def test_reader_special_dtypes(self):
320317

0 commit comments

Comments
 (0)