<p dir="auto">Possibly related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="164657422" data-permission-text="Title is private" data-url="https://github.com/pandas-dev/pandas/issues/13591" data-hovercard-type="issue" data-hovercard-url="/pandas-dev/pandas/issues/13591/hovercard" href="https://github.com/pandas-dev/pandas/issues/13591">#13591</a>. Causes <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="170081395" data-permission-text="Title is private" data-url="https://github.com/dask/dask/issues/1452" data-hovercard-type="issue" data-hovercard-url="/dask/dask/issues/1452/hovercard" href="https://github.com/dask/dask/issues/1452">dask/dask#1452</a></p>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
pd.msgpack.unpackb(pd.msgpack.packb(&quot;a&quot;))"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-s1">pd</span>.<span class="pl-s1">msgpack</span>.<span class="pl-en">unpackb</span>(<span class="pl-s1">pd</span>.<span class="pl-s1">msgpack</span>.<span class="pl-en">packb</span>(<span class="pl-s">"a"</span>))</pre></div>
<h4 dir="auto">Expected Output</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;a&quot;"><pre class="notranslate"><code class="notranslate">"a"
</code></pre></div>
<p dir="auto">instead, we get</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="b&quot;a&quot;"><pre class="notranslate"><code class="notranslate">b"a"
</code></pre></div>
<h4 dir="auto">output of <code class="notranslate">pd.show_versions()</code></h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-31-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 25.1.6
Cython: None
numpy: 1.11.1
scipy: None
statsmodels: None
xarray: None
IPython: 5.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-31-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.18.1
nose: None
pip: 8.1.2
setuptools: 25.1.6
Cython: None
numpy: 1.11.1
scipy: None
statsmodels: None
xarray: None
IPython: 5.0.0
sphinx: None
patsy: None
dateutil: 2.5.3
pytz: 2016.6.1
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
pandas_datareader: None
</code></pre></div>
<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<p dir="auto">Step 1. Run the code with Python 2 and Python 3</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from sys import version

from pandas import DataFrame

print(version)
vers = version[0]

file_name = 'foobar'
data = {'a': [1], 'b': [2]}
dtf = DataFrame(data=data)
dtf.to_msgpack(file_name + '_py{}.msg'.format(vers))"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">sys</span> <span class="pl-k">import</span> <span class="pl-s1">version</span>

<span class="pl-k">from</span> <span class="pl-s1">pandas</span> <span class="pl-k">import</span> <span class="pl-v">DataFrame</span>

<span class="pl-en">print</span>(<span class="pl-s1">version</span>)
<span class="pl-s1">vers</span> <span class="pl-c1">=</span> <span class="pl-s1">version</span>[<span class="pl-c1">0</span>]

<span class="pl-s1">file_name</span> <span class="pl-c1">=</span> <span class="pl-s">'foobar'</span>
<span class="pl-s1">data</span> <span class="pl-c1">=</span> {<span class="pl-s">'a'</span>: [<span class="pl-c1">1</span>], <span class="pl-s">'b'</span>: [<span class="pl-c1">2</span>]}
<span class="pl-s1">dtf</span> <span class="pl-c1">=</span> <span class="pl-v">DataFrame</span>(<span class="pl-s1">data</span><span class="pl-c1">=</span><span class="pl-s1">data</span>)
<span class="pl-s1">dtf</span>.<span class="pl-en">to_msgpack</span>(<span class="pl-s1">file_name</span> <span class="pl-c1">+</span> <span class="pl-s">'_py{}.msg'</span>.<span class="pl-en">format</span>(<span class="pl-s1">vers</span>))</pre></div>
<p dir="auto">Step 2. Run the code with Python 2 and Python 3</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from sys import version

from pandas import read_msgpack

print(version)
vers = version[0]

file_name = 'foobar'
dtf = read_msgpack(file_name + '_py3.msg'.format(vers))
print(dtf.columns)
print(dtf.a)

dtf = read_msgpack(file_name + '_py2.msg'.format(vers))
# dtf.columns = [i.decode(&quot;utf-8&quot;) for i in dtf.columns]
print(dtf.columns)
print(dtf.a)"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">sys</span> <span class="pl-k">import</span> <span class="pl-s1">version</span>

<span class="pl-k">from</span> <span class="pl-s1">pandas</span> <span class="pl-k">import</span> <span class="pl-s1">read_msgpack</span>

<span class="pl-en">print</span>(<span class="pl-s1">version</span>)
<span class="pl-s1">vers</span> <span class="pl-c1">=</span> <span class="pl-s1">version</span>[<span class="pl-c1">0</span>]

<span class="pl-s1">file_name</span> <span class="pl-c1">=</span> <span class="pl-s">'foobar'</span>
<span class="pl-s1">dtf</span> <span class="pl-c1">=</span> <span class="pl-en">read_msgpack</span>(<span class="pl-s1">file_name</span> <span class="pl-c1">+</span> <span class="pl-s">'_py3.msg'</span>.<span class="pl-en">format</span>(<span class="pl-s1">vers</span>))
<span class="pl-en">print</span>(<span class="pl-s1">dtf</span>.<span class="pl-s1">columns</span>)
<span class="pl-en">print</span>(<span class="pl-s1">dtf</span>.<span class="pl-s1">a</span>)

<span class="pl-s1">dtf</span> <span class="pl-c1">=</span> <span class="pl-en">read_msgpack</span>(<span class="pl-s1">file_name</span> <span class="pl-c1">+</span> <span class="pl-s">'_py2.msg'</span>.<span class="pl-en">format</span>(<span class="pl-s1">vers</span>))
<span class="pl-c"># dtf.columns = [i.decode("utf-8") for i in dtf.columns]</span>
<span class="pl-en">print</span>(<span class="pl-s1">dtf</span>.<span class="pl-s1">columns</span>)
<span class="pl-en">print</span>(<span class="pl-s1">dtf</span>.<span class="pl-s1">a</span>)</pre></div>
<h4 dir="auto">Expected Output</h4>
<p dir="auto">Same result with Python 2 and Python 3<br>
Python 2 output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]
Index([u'a', u'b'], dtype='object')
0    1
Name: a, dtype: int64
Index([u'a', u'b'], dtype='object')
0    1
Name: a, dtype: int64"><pre class="notranslate"><code class="notranslate">2.7.10 (default, Oct 23 2015, 19:19:21) 
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)]
Index([u'a', u'b'], dtype='object')
0    1
Name: a, dtype: int64
Index([u'a', u'b'], dtype='object')
0    1
Name: a, dtype: int64
</code></pre></div>
<p dir="auto">Python 3 output, the exception it is not expected:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Index(['a', 'b'], dtype='object')
0    1
Name: a, dtype: int64
Index([b'a', b'b'], dtype='object')
Traceback (most recent call last):
  File &quot;/Users/VV/GitHub/doptimization/bug_msgpack_reader.py&quot;, line 16, in &lt;module&gt;
    print(dtf.a)
  File &quot;/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/generic.py&quot;, line 2669, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'a'"><pre class="notranslate"><code class="notranslate">3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Index(['a', 'b'], dtype='object')
0    1
Name: a, dtype: int64
Index([b'a', b'b'], dtype='object')
Traceback (most recent call last):
  File "/Users/VV/GitHub/doptimization/bug_msgpack_reader.py", line 16, in &lt;module&gt;
    print(dtf.a)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pandas/core/generic.py", line 2669, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'a'
</code></pre></div>
<h4 dir="auto">output of <code class="notranslate">pd.show_versions()</code></h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.0
nose: None
pip: 8.1.2
setuptools: 20.6.7
Cython: None
numpy: 1.11.0
scipy: 0.16.1
statsmodels: None
xarray: None
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.0
nose: None
pip: 8.1.2
setuptools: 20.6.7
Cython: None
numpy: 1.11.0
scipy: 0.16.1
statsmodels: None
xarray: None
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: 2.3.5
xlrd: 1.0.0
xlwt: 1.0.0
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.5.0
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
None
3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Index(['a', 'b'], dtype='object')
0    1
Name: a, dtype: int64
Index([b'a', b'b'], dtype='object')
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: 2.3.5
xlrd: 1.0.0
xlwt: 1.0.0
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.5.0
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
None"><pre class="notranslate"><code class="notranslate">INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.0
nose: None
pip: 8.1.2
setuptools: 20.6.7
Cython: None
numpy: 1.11.0
scipy: 0.16.1
statsmodels: None
xarray: None
INSTALLED VERSIONS
------------------
commit: None
python: 3.5.1.final.0
python-bits: 64
OS: Darwin
OS-release: 15.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None

pandas: 0.18.0
nose: None
pip: 8.1.2
setuptools: 20.6.7
Cython: None
numpy: 1.11.0
scipy: 0.16.1
statsmodels: None
xarray: None
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: 2.3.5
xlrd: 1.0.0
xlwt: 1.0.0
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.5.0
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
None
3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Index(['a', 'b'], dtype='object')
0    1
Name: a, dtype: int64
Index([b'a', b'b'], dtype='object')
IPython: 4.0.1
sphinx: None
patsy: None
dateutil: 2.5.2
pytz: 2016.3
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.5.0
openpyxl: 2.3.5
xlrd: 1.0.0
xlwt: 1.0.0
xlsxwriter: None
lxml: None
bs4: 4.4.1
html5lib: None
httplib2: 0.9.2
apiclient: 1.5.0
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.8
boto: None
None
</code></pre></div>