From e3ebcb0128e27ad396285f20f58c756e62a67bb5 Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 21 Nov 2019 17:40:07 -0800 Subject: [PATCH 1/3] CLN: remove LegacyFoo from io.pytables --- pandas/io/pytables.py | 76 +------------------------------------------ 1 file changed, 1 insertion(+), 75 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index ba53d8cfd0de5..379f3e571e6bc 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -180,8 +180,6 @@ class DuplicateWarning(Warning): # storer class map _STORER_MAP = { "Series": "LegacySeriesFixed", - "DataFrame": "LegacyFrameFixed", - "DataMatrix": "LegacyFrameFixed", "series": "SeriesFixed", "frame": "FrameFixed", } @@ -3083,35 +3081,6 @@ def write_array(self, key: str, value, items=None): getattr(self.group, key)._v_attrs.transposed = transposed -class LegacyFixed(GenericFixed): - def read_index_legacy( - self, key: str, start: Optional[int] = None, stop: Optional[int] = None - ): - node = getattr(self.group, key) - data = node[start:stop] - kind = node._v_attrs.kind - return _unconvert_index_legacy( - data, kind, encoding=self.encoding, errors=self.errors - ) - - -class LegacySeriesFixed(LegacyFixed): - def read(self, **kwargs): - kwargs = self.validate_read(kwargs) - index = self.read_index_legacy("index") - values = self.read_array("values") - return Series(values, index=index) - - -class LegacyFrameFixed(LegacyFixed): - def read(self, **kwargs): - kwargs = self.validate_read(kwargs) - index = self.read_index_legacy("index") - columns = self.read_index_legacy("columns") - values = self.read_array("values") - return DataFrame(values, index=index, columns=columns) - - class SeriesFixed(GenericFixed): pandas_kind = "series" attributes = ["name"] @@ -4139,35 +4108,7 @@ def write(self, **kwargs): raise NotImplementedError("WORKTable needs to implement write") -class LegacyTable(Table): - """ an appendable table: allow append/query/delete operations to a - (possibly) already existing appendable table this table ALLOWS - append (but doesn't require them), and stores the data in a format - that can be easily searched - - """ - - _indexables: Optional[List[IndexCol]] = [ - IndexCol(name="index", axis=1, pos=0), - IndexCol(name="column", axis=2, pos=1, index_kind="columns_kind"), - DataCol(name="fields", cname="values", kind_attr="fields", pos=2), - ] - table_type = "legacy" - ndim = 3 - - def write(self, **kwargs): - raise TypeError("write operations are not allowed on legacy tables!") - - def read(self, where=None, columns=None, **kwargs): - """we have n indexable columns, with an arbitrary number of data - axes - """ - - if not self.read_axes(where=where, **kwargs): - return None - - -class AppendableTable(LegacyTable): +class AppendableTable(Table): """ support the new appendable table formats """ _indexables = None @@ -4866,21 +4807,6 @@ def _unconvert_index(data, kind, encoding=None, errors="strict"): return index -def _unconvert_index_legacy(data, kind, legacy=False, encoding=None, errors="strict"): - kind = _ensure_decoded(kind) - if kind == "datetime": - index = to_datetime(data) - elif kind in ("integer"): - index = np.asarray(data, dtype=object) - elif kind in ("string"): - index = _unconvert_string_array( - data, nan_rep=None, encoding=encoding, errors=errors - ) - else: # pragma: no cover - raise ValueError("unrecognized index type {kind}".format(kind=kind)) - return index - - def _convert_string_array(data, encoding, errors, itemsize=None): """ we take a string-like that is object dtype and coerce to a fixed size From c448f69354cedb9e63165e206e5007f425192cbb Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 21 Nov 2019 18:36:33 -0800 Subject: [PATCH 2/3] missed an entry in storer_map --- pandas/io/pytables.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 379f3e571e6bc..c38bc1e48b029 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -179,7 +179,6 @@ class DuplicateWarning(Warning): # storer class map _STORER_MAP = { - "Series": "LegacySeriesFixed", "series": "SeriesFixed", "frame": "FrameFixed", } From 0e3ceebf19cebef49b4b80d171dbc832729a151b Mon Sep 17 00:00:00 2001 From: jbrockmendel Date: Thu, 21 Nov 2019 19:04:37 -0800 Subject: [PATCH 3/3] whatsnew --- doc/source/whatsnew/v1.0.0.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/source/whatsnew/v1.0.0.rst b/doc/source/whatsnew/v1.0.0.rst index 54640ff576338..61e92f12e19af 100644 --- a/doc/source/whatsnew/v1.0.0.rst +++ b/doc/source/whatsnew/v1.0.0.rst @@ -321,6 +321,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more. - :meth:`pandas.Series.str.cat` now defaults to aligning ``others``, using ``join='left'`` (:issue:`27611`) - :meth:`pandas.Series.str.cat` does not accept list-likes *within* list-likes anymore (:issue:`27611`) - Removed the previously deprecated :meth:`ExtensionArray._formatting_values`. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`) +- Removed support for legacy HDF5 formats (:issue:`29787`) - :func:`read_excel` removed support for "skip_footer" argument, use "skipfooter" instead (:issue:`18836`) - :meth:`DataFrame.to_records` no longer supports the argument "convert_datetime64" (:issue:`18902`) - Removed the previously deprecated ``IntervalIndex.from_intervals`` in favor of the :class:`IntervalIndex` constructor (:issue:`19263`)