From dd1ec0271d1dd7193d1ebbfa40ac5948646002dc Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Thu, 31 Jan 2019 18:31:42 +0100
Subject: [PATCH 1/7] Fix value error when reading dataframe saved in python 2
 in python 3

---
 pandas/io/pytables.py                           |   2 +-
 .../io/data/legacy_hdf/legacy_table_py2.h5      | Bin 0 -> 72279 bytes
 pandas/tests/io/test_pytables.py                |  16 +++++++++++++++-
 3 files changed, 16 insertions(+), 2 deletions(-)
 create mode 100644 pandas/tests/io/data/legacy_hdf/legacy_table_py2.h5

diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py
index 4e103482f48a2..2ab6ddb5b25c7 100644
--- a/pandas/io/pytables.py
+++ b/pandas/io/pytables.py
@@ -3288,7 +3288,7 @@ def get_attrs(self):
         self.nan_rep = getattr(self.attrs, 'nan_rep', None)
         self.encoding = _ensure_encoding(
             getattr(self.attrs, 'encoding', None))
-        self.errors = getattr(self.attrs, 'errors', 'strict')
+        self.errors = _ensure_decoded(getattr(self.attrs, 'errors', 'strict'))
         self.levels = getattr(
             self.attrs, 'levels', None) or []
         self.index_axes = [
diff --git a/pandas/tests/io/data/legacy_hdf/legacy_table_py2.h5 b/pandas/tests/io/data/legacy_hdf/legacy_table_py2.h5
new file mode 100644
index 0000000000000000000000000000000000000000..3863d714a315b79de100e8446db766ec7dc2e82c
GIT binary patch
literal 72279
zcmeI#%}yIv6u|K@5O5q*2$iaeZdlb`Axyqlh89yS8G|rwQmN8(j3>yd8C$l4(p{JB
zTXdNR=^~HPw`k9~cMcu~oF-KlRq`M3jOWh%IP;r(?_B?Ou(!WlS}z5<6^p?_u<E|r
z?yq!vwq9^ac5c^yOuzW6LGWvO{(8=TDFlmwUi&;vUrp=ZnD+^Prs=0A^?D#Vt$sVE
zmxDKp{#(%!IDS+D2ld@!z2WESU0W}GllC*im_(g^EGO0<5A4FfJl;?HYrbEXgQ}}h
z`*%_PP8+99>A=CK^3k@feV0jg`TSouciU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}P
zv44*Gz^&ZP_k-_OQP_2BjeK1Cen`%DZp77jdt6s<;(T14@crWIWa7HsA199=Iuq;1
zixOioXq_BAYfJj9=i@rRT-V=yy1uq?IX%k7Tej!x*AsP8)lJ_GYzQEL00Iag@L>x?
zwt%n&RVV$y_+j5RcZUE12q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*sr
zAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_0
z00IagfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@
z2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000Iag
zfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}
z0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*srAb<b@2q1s}0tg_000IagfB*sr
XAb<b@2q1s}0tg_000Iag;068$pZG^R

literal 0
HcmV?d00001

diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py
index 517a3e059469c..bd88206072f47 100644
--- a/pandas/tests/io/test_pytables.py
+++ b/pandas/tests/io/test_pytables.py
@@ -4540,7 +4540,7 @@ def test_pytables_native2_read(self, datapath):
 
     def test_legacy_table_fixed_format_read_py2(self, datapath):
         # GH 24510
-        # legacy table with fixed format written en Python 2
+        # legacy table with fixed format written in Python 2
         with ensure_clean_store(
                 datapath('io', 'data', 'legacy_hdf',
                          'legacy_table_fixed_py2.h5'),
@@ -4552,6 +4552,20 @@ def test_legacy_table_fixed_format_read_py2(self, datapath):
                                                    name='INDEX_NAME'))
             assert_frame_equal(expected, result)
 
+    def test_legacy_table_read_py2(self, datapath):
+        # GH xxxxx
+        # legacy table written en Python 2
+        with ensure_clean_store(
+                datapath('io', 'data', 'legacy_hdf',
+                         'legacy_table_py2.h5'),
+                mode='r') as store:
+            result = store.select('table')
+            expected = pd.DataFrame({
+                "a": ["a", "b"],
+                "b": [2, 3]
+            })
+            assert_frame_equal(expected, result)
+
     def test_legacy_table_read(self, datapath):
         # legacy table types
         with ensure_clean_store(

From 6871358aa3a05c70a69d9ee0cc430aa95551c4e3 Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Thu, 31 Jan 2019 18:46:59 +0100
Subject: [PATCH 2/7] Typo fixed

---
 pandas/tests/io/test_pytables.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py
index bd88206072f47..49744d192c9b5 100644
--- a/pandas/tests/io/test_pytables.py
+++ b/pandas/tests/io/test_pytables.py
@@ -4554,7 +4554,7 @@ def test_legacy_table_fixed_format_read_py2(self, datapath):
 
     def test_legacy_table_read_py2(self, datapath):
         # GH xxxxx
-        # legacy table written en Python 2
+        # legacy table written in Python 2
         with ensure_clean_store(
                 datapath('io', 'data', 'legacy_hdf',
                          'legacy_table_py2.h5'),

From 70c7ab197fa216079fd4a9b913fddca9f70bcc66 Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Thu, 31 Jan 2019 18:53:22 +0100
Subject: [PATCH 3/7] Bug description

---
 doc/source/whatsnew/v0.24.1.rst  | 2 +-
 pandas/tests/io/test_pytables.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/source/whatsnew/v0.24.1.rst b/doc/source/whatsnew/v0.24.1.rst
index 521319c55a503..d0be8c518bc59 100644
--- a/doc/source/whatsnew/v0.24.1.rst
+++ b/doc/source/whatsnew/v0.24.1.rst
@@ -50,7 +50,7 @@ Bug Fixes
 
 **I/O**
 
--
+- Bug in :class:`HDFStore` that caused it to raise ``ValueError`` when reading a Dataframe in Python 3 from dataframe written in Python 2 (:issue:`24925`)
 -
 -
 
diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py
index 49744d192c9b5..28b7e4aefc129 100644
--- a/pandas/tests/io/test_pytables.py
+++ b/pandas/tests/io/test_pytables.py
@@ -4553,7 +4553,7 @@ def test_legacy_table_fixed_format_read_py2(self, datapath):
             assert_frame_equal(expected, result)
 
     def test_legacy_table_read_py2(self, datapath):
-        # GH xxxxx
+        # issue: 24925
         # legacy table written in Python 2
         with ensure_clean_store(
                 datapath('io', 'data', 'legacy_hdf',

From 0fa7102f96fde9b2f70a2cddb070ff973963d940 Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Fri, 1 Feb 2019 11:38:29 +0100
Subject: [PATCH 4/7] Construct expected dataframe and assert outside of with
 statement

---
 pandas/tests/io/test_pytables.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py
index 28b7e4aefc129..ba9f6a137cbeb 100644
--- a/pandas/tests/io/test_pytables.py
+++ b/pandas/tests/io/test_pytables.py
@@ -4560,11 +4560,12 @@ def test_legacy_table_read_py2(self, datapath):
                          'legacy_table_py2.h5'),
                 mode='r') as store:
             result = store.select('table')
-            expected = pd.DataFrame({
-                "a": ["a", "b"],
-                "b": [2, 3]
-            })
-            assert_frame_equal(expected, result)
+            
+        expected = pd.DataFrame({
+            "a": ["a", "b"],
+            "b": [2, 3]
+        })
+        assert_frame_equal(expected, result)
 
     def test_legacy_table_read(self, datapath):
         # legacy table types

From f9ab13353ce86b3a7c00cbf836879422605236d0 Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Fri, 1 Feb 2019 11:43:13 +0100
Subject: [PATCH 5/7] Pep8 warning fixed

---
 pandas/tests/io/test_pytables.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py
index ba9f6a137cbeb..9430011288f27 100644
--- a/pandas/tests/io/test_pytables.py
+++ b/pandas/tests/io/test_pytables.py
@@ -4560,7 +4560,7 @@ def test_legacy_table_read_py2(self, datapath):
                          'legacy_table_py2.h5'),
                 mode='r') as store:
             result = store.select('table')
-            
+
         expected = pd.DataFrame({
             "a": ["a", "b"],
             "b": [2, 3]

From abf6c3541f061f6aed5290120972bffa361e4c5e Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Fri, 1 Feb 2019 20:12:50 +0100
Subject: [PATCH 6/7] Documentation updated, moved to 0.24.2

---
 doc/source/whatsnew/v0.24.1.rst | 2 +-
 doc/source/whatsnew/v0.24.2.rst | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/source/whatsnew/v0.24.1.rst b/doc/source/whatsnew/v0.24.1.rst
index 16ac7c94777f5..c8b5417a5b77f 100644
--- a/doc/source/whatsnew/v0.24.1.rst
+++ b/doc/source/whatsnew/v0.24.1.rst
@@ -52,7 +52,7 @@ Bug Fixes
 
 **I/O**
 
-- Bug in :class:`HDFStore` that caused it to raise ``ValueError`` when reading a Dataframe in Python 3 from dataframe written in Python 2 (:issue:`24925`)
+-
 -
 -
 
diff --git a/doc/source/whatsnew/v0.24.2.rst b/doc/source/whatsnew/v0.24.2.rst
index cba21ce7ee1e6..f71241b630fb8 100644
--- a/doc/source/whatsnew/v0.24.2.rst
+++ b/doc/source/whatsnew/v0.24.2.rst
@@ -51,7 +51,7 @@ Bug Fixes
 
 **I/O**
 
--
+- Bug in reading a HDF5 table-format ``DataFrame`` created in Python 2, in Python 3
 -
 -
 

From 12043014ba2edb80089a88d345cb49805cc9ab0a Mon Sep 17 00:00:00 2001
From: Radek Benes <radek.benes@innovatrics.com>
Date: Fri, 1 Feb 2019 20:34:38 +0100
Subject: [PATCH 7/7] Issue number is back in documentation

---
 doc/source/whatsnew/v0.24.2.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/doc/source/whatsnew/v0.24.2.rst b/doc/source/whatsnew/v0.24.2.rst
index f71241b630fb8..316fc21c126ac 100644
--- a/doc/source/whatsnew/v0.24.2.rst
+++ b/doc/source/whatsnew/v0.24.2.rst
@@ -51,7 +51,7 @@ Bug Fixes
 
 **I/O**
 
-- Bug in reading a HDF5 table-format ``DataFrame`` created in Python 2, in Python 3
+- Bug in reading a HDF5 table-format ``DataFrame`` created in Python 2, in Python 3 (:issue:`24925`)
 -
 -