Repository navigation
Closed
Labels
Description
Seeing the following failure from test_info in test_dataframe on Python 2.7. Not sure what is causing it. Suggestions welcome.
_________________________________________________________________________ test_info _________________________________________________________________________
def test_info():
from io import StringIO
from dask.compatibility import unicode
pandas_format._put_lines = put_lines
test_frames = [
pd.DataFrame({'x': [1, 2, 3, 4], 'y': [1, 0, 1, 0]}, index=pd.Int64Index(range(4))), # No RangeIndex in dask
pd.DataFrame()
]
for df in test_frames:
ddf = dd.from_pandas(df, npartitions=4)
> _assert_info(df, ddf)
dask/dataframe/tests/test_dataframe.py:2403:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dask/dataframe/tests/test_dataframe.py:2382: in _assert_info
df.info(buf=buf_pd, memory_usage=memory_usage)
../.conda/envs/dask_py27/lib/python2.7/site-packages/pandas/core/frame.py:2183: in info
fmt.buffer_put_lines(buf, lines)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
buf = <_io.StringIO object at 0x7f6835209050>, lines = ["<class 'pandas.core.frame.DataFrame'>", 'Index: 0 entries', 'Empty DataFrame']
def buffer_put_lines(buf, lines):
"""
Appends lines to a buffer.
Parameters
----------
buf
The buffer to write to
lines
The lines to append.
"""
if any(isinstance(x, compat.text_type) for x in lines):
lines = [compat.text_type(x) for x in lines]
> buf.write('\n'.join(lines))
E TypeError: unicode argument expected, got 'str'
../.conda/envs/dask_py27/lib/python2.7/site-packages/pandas/io/formats/format.py:1606: TypeError
===================================================================== warnings summary ======================================================================
dask/dataframe/tests/test_dataframe.py::test_mixed_dask_array_operations
/groups/dudman/home/kirkhamj/.conda/envs/dask_py27/lib/python2.7/site-packages/numpy/core/_methods.py:26: RuntimeWarning: invalid value encountered in reduce
return umr_maximum(a, axis, None, out, keepdims)
-- Docs: http://doc.pytest.org/en/latest/warnings.html
========================================= 1 failed, 431 passed, 115 skipped, 1 xfailed, 1 warnings in 44.64 seconds =========================================
Activity
jakirkham commentedon Jul 20, 2018
This error is getting propagated up from Pandas. Doesn't mean it is a Pandas bug, but it could be. @TomAugspurger, any thoughts on this one? If nothing obvious sticks out, would recommend we mark this as a known fail on Python 2.7, but keep this issue open to revisit down the road.
TomAugspurger commentedon Jul 21, 2018
Strange. The error is consistent with
io.StringIO().write("abc"), when it should be.write(u"abc").You see this error only locally, or is there a CI faliure? I suspect that making the DataFrame column names unicode would solve this, or I'm fine with just skipping.
jakirkham commentedon Jul 22, 2018
Thanks for taking a look Tom.
Saw this locally. Though expect it could occur on CI if used a newer version of
pandasin the Python 2.7 build. Thebuffer_put_linesfunction was added in PR ( pandas-dev/pandas#20341 ), which was added in 0.23.0. Currently we are usingpandas0.22.0 with Python 2.7.mrocklin commentedon Oct 22, 2018
I'm curious, what ever happened here?
quasiben commentedon Apr 30, 2019
@jakirkham I suspect we can close this? Do you have thoughts ?
jakirkham commentedon Apr 30, 2019
Sure, let's close this. My guess is the issue has gone away (given the age and quiet nature of this issue).