42
42
from pandas .errors import EmptyDataError
43
43
from pandas .util ._decorators import (
44
44
Appender ,
45
- deprecate_kwarg ,
46
- deprecate_nonkeyword_arguments ,
47
45
doc ,
48
46
)
49
47
from pandas .util ._exceptions import find_stack_level
269
267
comment string and the end of the current line is ignored.
270
268
skipfooter : int, default 0
271
269
Rows at the end to skip (0-indexed).
272
- convert_float : bool, default True
273
- Convert integral floats to int (i.e., 1.0 --> 1). If False, all numeric
274
- data will be read in as floats: Excel stores all numbers as floats
275
- internally.
276
-
277
- .. deprecated:: 1.3.0
278
- convert_float will be removed in a future version
279
-
280
- mangle_dupe_cols : bool, default True
281
- Duplicate columns will be specified as 'X', 'X.1', ...'X.N', rather than
282
- 'X'...'X'. Passing in False will cause data to be overwritten if there
283
- are duplicate names in the columns.
284
-
285
- .. deprecated:: 1.5.0
286
- Not implemented, and a new argument to specify the pattern for the
287
- names of duplicated columns will be added instead
288
-
289
270
{storage_options}
290
271
291
272
.. versionadded:: 1.2.0
@@ -365,6 +346,7 @@ def read_excel(
365
346
io ,
366
347
# sheet name is str or int -> DataFrame
367
348
sheet_name : str | int = ...,
349
+ * ,
368
350
header : int | Sequence [int ] | None = ...,
369
351
names : list [str ] | None = ...,
370
352
index_col : int | Sequence [int ] | None = ...,
@@ -392,8 +374,6 @@ def read_excel(
392
374
decimal : str = ...,
393
375
comment : str | None = ...,
394
376
skipfooter : int = ...,
395
- convert_float : bool | None = ...,
396
- mangle_dupe_cols : bool = ...,
397
377
storage_options : StorageOptions = ...,
398
378
) -> DataFrame :
399
379
...
@@ -404,6 +384,7 @@ def read_excel(
404
384
io ,
405
385
# sheet name is list or None -> dict[IntStrT, DataFrame]
406
386
sheet_name : list [IntStrT ] | None ,
387
+ * ,
407
388
header : int | Sequence [int ] | None = ...,
408
389
names : list [str ] | None = ...,
409
390
index_col : int | Sequence [int ] | None = ...,
@@ -431,20 +412,17 @@ def read_excel(
431
412
decimal : str = ...,
432
413
comment : str | None = ...,
433
414
skipfooter : int = ...,
434
- convert_float : bool | None = ...,
435
- mangle_dupe_cols : bool = ...,
436
415
storage_options : StorageOptions = ...,
437
416
) -> dict [IntStrT , DataFrame ]:
438
417
...
439
418
440
419
441
420
@doc (storage_options = _shared_docs ["storage_options" ])
442
- @deprecate_kwarg (old_arg_name = "mangle_dupe_cols" , new_arg_name = None )
443
- @deprecate_nonkeyword_arguments (allowed_args = ["io" , "sheet_name" ], version = "2.0" )
444
421
@Appender (_read_excel_doc )
445
422
def read_excel (
446
423
io ,
447
424
sheet_name : str | int | list [IntStrT ] | None = 0 ,
425
+ * ,
448
426
header : int | Sequence [int ] | None = 0 ,
449
427
names : list [str ] | None = None ,
450
428
index_col : int | Sequence [int ] | None = None ,
@@ -472,8 +450,6 @@ def read_excel(
472
450
decimal : str = "." ,
473
451
comment : str | None = None ,
474
452
skipfooter : int = 0 ,
475
- convert_float : bool | None = None ,
476
- mangle_dupe_cols : bool = True ,
477
453
storage_options : StorageOptions = None ,
478
454
) -> DataFrame | dict [IntStrT , DataFrame ]:
479
455
@@ -511,8 +487,6 @@ def read_excel(
511
487
decimal = decimal ,
512
488
comment = comment ,
513
489
skipfooter = skipfooter ,
514
- convert_float = convert_float ,
515
- mangle_dupe_cols = mangle_dupe_cols ,
516
490
)
517
491
finally :
518
492
# make sure to close opened file handles
@@ -588,7 +562,7 @@ def get_sheet_by_index(self, index: int):
588
562
pass
589
563
590
564
@abc .abstractmethod
591
- def get_sheet_data (self , sheet , convert_float : bool , rows : int | None = None ):
565
+ def get_sheet_data (self , sheet , rows : int | None = None ):
592
566
pass
593
567
594
568
def raise_if_bad_sheet_by_index (self , index : int ) -> None :
@@ -716,20 +690,9 @@ def parse(
716
690
decimal : str = "." ,
717
691
comment : str | None = None ,
718
692
skipfooter : int = 0 ,
719
- convert_float : bool | None = None ,
720
- mangle_dupe_cols : bool = True ,
721
693
** kwds ,
722
694
):
723
695
724
- if convert_float is None :
725
- convert_float = True
726
- else :
727
- warnings .warn (
728
- "convert_float is deprecated and will be removed in a future version." ,
729
- FutureWarning ,
730
- stacklevel = find_stack_level (),
731
- )
732
-
733
696
validate_header_arg (header )
734
697
validate_integer ("nrows" , nrows )
735
698
@@ -763,7 +726,7 @@ def parse(
763
726
sheet = self .get_sheet_by_index (asheetname )
764
727
765
728
file_rows_needed = self ._calc_rows (header , index_col , skiprows , nrows )
766
- data = self .get_sheet_data (sheet , convert_float , file_rows_needed )
729
+ data = self .get_sheet_data (sheet , file_rows_needed )
767
730
if hasattr (sheet , "close" ):
768
731
# pyxlsb opens two TemporaryFiles
769
732
sheet .close ()
@@ -885,7 +848,6 @@ def parse(
885
848
comment = comment ,
886
849
skipfooter = skipfooter ,
887
850
usecols = usecols ,
888
- mangle_dupe_cols = mangle_dupe_cols ,
889
851
** kwds ,
890
852
)
891
853
@@ -1718,8 +1680,6 @@ def parse(
1718
1680
thousands : str | None = None ,
1719
1681
comment : str | None = None ,
1720
1682
skipfooter : int = 0 ,
1721
- convert_float : bool | None = None ,
1722
- mangle_dupe_cols : bool = True ,
1723
1683
** kwds ,
1724
1684
) -> DataFrame | dict [str , DataFrame ] | dict [int , DataFrame ]:
1725
1685
"""
@@ -1751,8 +1711,6 @@ def parse(
1751
1711
thousands = thousands ,
1752
1712
comment = comment ,
1753
1713
skipfooter = skipfooter ,
1754
- convert_float = convert_float ,
1755
- mangle_dupe_cols = mangle_dupe_cols ,
1756
1714
** kwds ,
1757
1715
)
1758
1716
0 commit comments