Skip to content

Commit eda1924

Browse files
taeoldjreback
authored andcommitted
DEPR: deprecate engine keyword from to_csv pandas-dev#11274
1 parent 7b37a40 commit eda1924

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

doc/source/whatsnew/v0.17.1.txt

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Deprecations
4444
^^^^^^^^^^^^
4545

4646
- The ``pandas.io.ga`` module which implements ``google-analytics`` support is deprecated and will be removed in a future version (:issue:`11308`)
47+
- Deprecate the ``engine`` keyword from ``.to_csv()``, which will be removed in a future version (:issue:`11274`)
48+
4749

4850
.. _whatsnew_0171.performance:
4951

pandas/core/format.py

+6-1
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

+6
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)