Skip to content

Commit 3adc2e7

Browse files
jbrockmendeljreback
authored andcommitted
CLN: remove LegacyFoo from io.pytables (#29787)
1 parent 36016ba commit 3adc2e7

File tree

2 files changed

+2
-76
lines changed

2 files changed

+2
-76
lines changed

doc/source/whatsnew/v1.0.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
322322
- :meth:`pandas.Series.str.cat` now defaults to aligning ``others``, using ``join='left'`` (:issue:`27611`)
323323
- :meth:`pandas.Series.str.cat` does not accept list-likes *within* list-likes anymore (:issue:`27611`)
324324
- Removed the previously deprecated :meth:`ExtensionArray._formatting_values`. Use :attr:`ExtensionArray._formatter` instead. (:issue:`23601`)
325+
- Removed support for legacy HDF5 formats (:issue:`29787`)
325326
- :func:`read_excel` removed support for "skip_footer" argument, use "skipfooter" instead (:issue:`18836`)
326327
- :meth:`DataFrame.to_records` no longer supports the argument "convert_datetime64" (:issue:`18902`)
327328
- Removed the previously deprecated ``IntervalIndex.from_intervals`` in favor of the :class:`IntervalIndex` constructor (:issue:`19263`)

pandas/io/pytables.py

+1-76
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,6 @@ class DuplicateWarning(Warning):
179179

180180
# storer class map
181181
_STORER_MAP = {
182-
"Series": "LegacySeriesFixed",
183-
"DataFrame": "LegacyFrameFixed",
184-
"DataMatrix": "LegacyFrameFixed",
185182
"series": "SeriesFixed",
186183
"frame": "FrameFixed",
187184
}
@@ -3083,35 +3080,6 @@ def write_array(self, key: str, value, items=None):
30833080
getattr(self.group, key)._v_attrs.transposed = transposed
30843081

30853082

3086-
class LegacyFixed(GenericFixed):
3087-
def read_index_legacy(
3088-
self, key: str, start: Optional[int] = None, stop: Optional[int] = None
3089-
):
3090-
node = getattr(self.group, key)
3091-
data = node[start:stop]
3092-
kind = node._v_attrs.kind
3093-
return _unconvert_index_legacy(
3094-
data, kind, encoding=self.encoding, errors=self.errors
3095-
)
3096-
3097-
3098-
class LegacySeriesFixed(LegacyFixed):
3099-
def read(self, **kwargs):
3100-
kwargs = self.validate_read(kwargs)
3101-
index = self.read_index_legacy("index")
3102-
values = self.read_array("values")
3103-
return Series(values, index=index)
3104-
3105-
3106-
class LegacyFrameFixed(LegacyFixed):
3107-
def read(self, **kwargs):
3108-
kwargs = self.validate_read(kwargs)
3109-
index = self.read_index_legacy("index")
3110-
columns = self.read_index_legacy("columns")
3111-
values = self.read_array("values")
3112-
return DataFrame(values, index=index, columns=columns)
3113-
3114-
31153083
class SeriesFixed(GenericFixed):
31163084
pandas_kind = "series"
31173085
attributes = ["name"]
@@ -4139,35 +4107,7 @@ def write(self, **kwargs):
41394107
raise NotImplementedError("WORKTable needs to implement write")
41404108

41414109

4142-
class LegacyTable(Table):
4143-
""" an appendable table: allow append/query/delete operations to a
4144-
(possibly) already existing appendable table this table ALLOWS
4145-
append (but doesn't require them), and stores the data in a format
4146-
that can be easily searched
4147-
4148-
"""
4149-
4150-
_indexables: Optional[List[IndexCol]] = [
4151-
IndexCol(name="index", axis=1, pos=0),
4152-
IndexCol(name="column", axis=2, pos=1, index_kind="columns_kind"),
4153-
DataCol(name="fields", cname="values", kind_attr="fields", pos=2),
4154-
]
4155-
table_type = "legacy"
4156-
ndim = 3
4157-
4158-
def write(self, **kwargs):
4159-
raise TypeError("write operations are not allowed on legacy tables!")
4160-
4161-
def read(self, where=None, columns=None, **kwargs):
4162-
"""we have n indexable columns, with an arbitrary number of data
4163-
axes
4164-
"""
4165-
4166-
if not self.read_axes(where=where, **kwargs):
4167-
return None
4168-
4169-
4170-
class AppendableTable(LegacyTable):
4110+
class AppendableTable(Table):
41714111
""" support the new appendable table formats """
41724112

41734113
_indexables = None
@@ -4866,21 +4806,6 @@ def _unconvert_index(data, kind, encoding=None, errors="strict"):
48664806
return index
48674807

48684808

4869-
def _unconvert_index_legacy(data, kind, legacy=False, encoding=None, errors="strict"):
4870-
kind = _ensure_decoded(kind)
4871-
if kind == "datetime":
4872-
index = to_datetime(data)
4873-
elif kind in ("integer"):
4874-
index = np.asarray(data, dtype=object)
4875-
elif kind in ("string"):
4876-
index = _unconvert_string_array(
4877-
data, nan_rep=None, encoding=encoding, errors=errors
4878-
)
4879-
else: # pragma: no cover
4880-
raise ValueError("unrecognized index type {kind}".format(kind=kind))
4881-
return index
4882-
4883-
48844809
def _convert_string_array(data, encoding, errors, itemsize=None):
48854810
"""
48864811
we take a string-like that is object dtype and coerce to a fixed size

0 commit comments

Comments
 (0)