Fix ValueError when reading a Dataframe with HDFStore in Python 3 fro…
State: closed

Pull request to solve : 24404

- [ ] closes #24404
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`


Labels:
name: IO HDF5
description: read_hdf, HDFStore

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=h1) Report
> Merging [#24510](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/100ffffa0ace51baac7045ca51fecf228e54bc5b?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `0%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24510/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master   #24510   +/-   ##
=======================================
  Coverage   31.89%   31.89%           
=======================================
  Files         166      166           
  Lines       52421    52421           
=======================================
  Hits        16722    16722           
  Misses      35699    35699
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `30.29% <0%> (ø)` | :arrow_up: |
| #single | `31.89% <0%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `19.53% <0%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=footer). Last update [100ffff...66c7e8d](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=h1) Report
> Merging [#24510](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/100ffffa0ace51baac7045ca51fecf228e54bc5b?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `0%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/24510/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #24510      +/-   ##
==========================================
- Coverage   31.89%   31.88%   -0.02%     
==========================================
  Files         166      166              
  Lines       52421    52426       +5     
==========================================
- Hits        16722    16717       -5     
- Misses      35699    35709      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `30.29% <0%> (-0.01%)` | :arrow_down: |
| #single | `31.88% <0%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `19.52% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/internals/blocks.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW50ZXJuYWxzL2Jsb2Nrcy5weQ==) | `38.09% <0%> (-0.4%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `27.82% <0%> (-0.14%)` | :arrow_down: |
| [pandas/core/reshape/reshape.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9yZXNoYXBlLnB5) | `7.97% <0%> (-0.09%)` | :arrow_down: |
| [pandas/core/reshape/pivot.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9waXZvdC5weQ==) | `8.77% <0%> (ø)` | :arrow_up: |
| [pandas/core/computation/expressions.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwcmVzc2lvbnMucHk=) | `58.82% <0%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `31.41% <0%> (ø)` | :arrow_up: |
| [pandas/plotting/\_style.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL3Bsb3R0aW5nL19zdHlsZS5weQ==) | `23.65% <0%> (ø)` | :arrow_up: |
| [pandas/core/groupby/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9nZW5lcmljLnB5) | `13.71% <0%> (ø)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `29.81% <0%> (+0.12%)` | :arrow_up: |
| ... and [2 more](https://codecov.io/gh/pandas-dev/pandas/pull/24510/diff?src=pr&el=tree-more) | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=footer). Last update [100ffff...173265c](https://codecov.io/gh/pandas-dev/pandas/pull/24510?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

so need a sample hdf file that we can include in the repo, generated in py2, that fails on reading (make a new test), and works with your patch. you can put it in here: pandas/tests/io/data/legacy_hdf

read it like

```
def test_legacy_table_read(self, datapath):
        # legacy table types
        with ensure_clean_store(
                datapath('io', 'data', 'legacy_hdf', 'legacy_table.h5'),
                mode='r') as store:

            with catch_warnings():
                simplefilter("ignore", pd.io.pytables.IncompatibilityWarning)
                store.select('df1')
                store.select('df2')
                store.select('wp1')

```
lgtm @faulaire ping on green.
thanks @faulaire 
Thanks for the review & commit @jreback