Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPR: deprecate engine keyword from to_csv #11274 #11319

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/source/whatsnew/v0.17.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ API changes

.. _whatsnew_0171.deprecations:

- ``engine`` keyword is deprecated from ``.to_csv()`` and will be removed in a future version (:issue:`11274`)

Deprecations
^^^^^^^^^^^^

Expand Down
7 changes: 6 additions & 1 deletion pandas/core/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import itertools
import csv
import warnings

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

self.engine = engine # remove for 0.13
if engine is not None:
warnings.warn("'engine' keyword is deprecated and "
"will be removed in a future version",
FutureWarning, stacklevel=3)
self.engine = engine # remove for 0.18
self.obj = obj

if path_or_buf is None:
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2952,6 +2952,12 @@ def test_to_csv_date_format(self):
self.assertEqual(df_day.to_csv(), expected_default_day)
self.assertEqual(df_day.to_csv(date_format='%Y-%m-%d'), expected_default_day)

# deprecation GH11274
def test_to_csv_engine_kw_deprecation(self):
with tm.assert_produces_warning(FutureWarning):
df = DataFrame({'col1' : [1], 'col2' : ['a'], 'col3' : [10.1] })
df.to_csv(engine='python')

def test_round_dataframe(self):

# GH 2665
Expand Down