You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromsysimportversionfrompandasimportread_msgpackprint(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("utf-8") for i in dtf.columns]print(dtf.columns)
print(dtf.a)
Expected Output
Same result with Python 2 and Python 3
Python 2 output:
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
Python 3 output, the exception it is not expected:
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 <module>
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 Sample, a copy-pastable example if possible
Step 1. Run the code with Python 2 and Python 3
Step 2. Run the code with Python 2 and Python 3
Expected Output
Same result with Python 2 and Python 3
Python 2 output:
Python 3 output, the exception it is not expected:
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: