From 96dd0b80a45d24d7207de75c758375521f442e74 Mon Sep 17 00:00:00 2001 From: jreback Date: Fri, 27 Sep 2013 15:19:40 -0400 Subject: [PATCH] API: Remove deprecated read_clipboard/to_clipboard/ExcelFile/ExcelWriter from pandas.io.parsers (GH3717) --- doc/source/api.rst | 9 +++++++++ doc/source/install.rst | 2 +- doc/source/release.rst | 1 + pandas/io/parsers.py | 24 ------------------------ pandas/io/tests/test_excel.py | 30 +++++------------------------- 5 files changed, 16 insertions(+), 50 deletions(-) diff --git a/doc/source/api.rst b/doc/source/api.rst index 28c1515e93bc5..8dcf9c0f52de4 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -31,6 +31,15 @@ Flat File read_table read_csv read_fwf + +Clipboard +~~~~~~~~~ + +.. currentmodule:: pandas.io.clipboard + +.. autosummary:: + :toctree: generated/ + read_clipboard Excel diff --git a/doc/source/install.rst b/doc/source/install.rst index 91e86a6aa1e29..532c90b83ebb0 100644 --- a/doc/source/install.rst +++ b/doc/source/install.rst @@ -111,7 +111,7 @@ Optional Dependencies `__, `xsel `__, or `xclip `__: necessary to use - :func:`~pandas.io.parsers.read_clipboard`. Most package managers on Linux + :func:`~pandas.io.clipboard.read_clipboard`. Most package managers on Linux distributions will have xclip and/or xsel immediately available for installation. * One of the following combinations of libraries is needed to use the diff --git a/doc/source/release.rst b/doc/source/release.rst index e49812b207921..f871a412d2ff6 100644 --- a/doc/source/release.rst +++ b/doc/source/release.rst @@ -245,6 +245,7 @@ API Changes - Remove deprecated ``_verbose_info`` (:issue:`3215`) - Begin removing methods that don't make sense on ``GroupBy`` objects (:issue:`4887`). + - Remove deprecated ``read_clipboard/to_clipboard/ExcelFile/ExcelWriter`` from ``pandas.io.parsers`` (:issue:`3717`) Internal Refactoring ~~~~~~~~~~~~~~~~~~~~ diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 426d71b05e30a..26f15d5ae2aea 100644 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -2048,27 +2048,3 @@ def __init__(self, f, **kwds): def _make_reader(self, f): self.data = FixedWidthReader(f, self.colspecs, self.delimiter, encoding=self.encoding) - - -##### deprecations in 0.12 ##### -##### remove in 0.12 ##### - -from pandas.io import clipboard -def read_clipboard(**kwargs): - warn("read_clipboard is now a top-level accessible via pandas.read_clipboard", FutureWarning) - clipboard.read_clipboard(**kwargs) - -def to_clipboard(obj): - warn("to_clipboard is now an object level method accessible via obj.to_clipboard()", FutureWarning) - clipboard.to_clipboard(obj) - -from pandas.io import excel -class ExcelWriter(excel.ExcelWriter): - def __init__(self, path): - warn("ExcelWriter can now be imported from: pandas.io.excel", FutureWarning) - super(ExcelWriter, self).__init__(path) - -class ExcelFile(excel.ExcelFile): - def __init__(self, path_or_buf, **kwds): - warn("ExcelFile can now be imported from: pandas.io.excel", FutureWarning) - super(ExcelFile, self).__init__(path_or_buf, **kwds) diff --git a/pandas/io/tests/test_excel.py b/pandas/io/tests/test_excel.py index cd101d325f21d..0c6332205ffe5 100644 --- a/pandas/io/tests/test_excel.py +++ b/pandas/io/tests/test_excel.py @@ -254,20 +254,20 @@ def test_excel_read_buffer(self): f = open(pth, 'rb') xl = ExcelFile(f) xl.parse('Sheet1', index_col=0, parse_dates=True) - + def test_read_xlrd_Book(self): _skip_if_no_xlrd() _skip_if_no_xlwt() - + import xlrd - + pth = '__tmp_excel_read_worksheet__.xls' df = self.frame - + with ensure_clean(pth) as pth: df.to_excel(pth, "SheetA") book = xlrd.open_workbook(pth) - + with ExcelFile(book, engine="xlrd") as xl: result = xl.parse("SheetA") tm.assert_frame_equal(df, result) @@ -1004,26 +1004,6 @@ def check_called(func): check_called(lambda: df.to_excel('something.xls', engine='dummy')) set_option('io.excel.xlsx.writer', val) - -class ExcelLegacyTests(SharedItems, unittest.TestCase): - def test_deprecated_from_parsers(self): - - # since 0.12 changed the import path - import warnings - - with warnings.catch_warnings(): - warnings.filterwarnings(action='ignore', category=FutureWarning) - - _skip_if_no_xlrd() - from pandas.io.parsers import ExcelFile as xf - xf(self.xls1) - - _skip_if_no_xlwt() - with ensure_clean('test.xls') as path: - from pandas.io.parsers import ExcelWriter as xw - xw(path) - - if __name__ == '__main__': nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'], exit=False)