Skip to content

Commit 234afcd

Browse files
committed
DEPR: deprecate engine keyword from to_csv pandas-dev#11274
1 parent c2aa6a2 commit 234afcd

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

doc/source/whatsnew/v0.17.1.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ API changes
4040

4141
.. _whatsnew_0171.deprecations:
4242

43+
- ``engine`` keyword is deprecated from ``.to_csv()`` and will be removed in a future version (:issue:`11274`)
44+
4345
Deprecations
4446
^^^^^^^^^^^^
4547

pandas/core/format.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
import itertools
2525
import csv
26+
import warnings
2627

2728
common_docstring = """
2829
Parameters
@@ -1264,7 +1265,11 @@ def __init__(self, obj, path_or_buf=None, sep=",", na_rep='', float_format=None,
12641265
tupleize_cols=False, quotechar='"', date_format=None,
12651266
doublequote=True, escapechar=None, decimal='.'):
12661267

1267-
self.engine = engine # remove for 0.13
1268+
if engine is not None:
1269+
warnings.warn("'engine' keyword is deprecated and "
1270+
"will be removed in a future version",
1271+
FutureWarning, stacklevel=3)
1272+
self.engine = engine # remove for 0.18
12681273
self.obj = obj
12691274

12701275
if path_or_buf is None:

pandas/tests/test_format.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2952,6 +2952,12 @@ def test_to_csv_date_format(self):
29522952
self.assertEqual(df_day.to_csv(), expected_default_day)
29532953
self.assertEqual(df_day.to_csv(date_format='%Y-%m-%d'), expected_default_day)
29542954

2955+
# deprecation GH11274
2956+
def test_to_csv_engine_kw_deprecation(self):
2957+
with tm.assert_produces_warning(FutureWarning):
2958+
df = DataFrame({'col1' : [1], 'col2' : ['a'], 'col3' : [10.1] })
2959+
df.to_csv(engine='python')
2960+
29552961
def test_round_dataframe(self):
29562962

29572963
# GH 2665

0 commit comments

Comments
 (0)