Skip to content

test_info from test_dataframe failing on Python 2.7 #3794

Closed

Description

@jakirkham

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

  1. jakirkham commented on Jul 20, 2018

    @jakirkham
    MemberAuthor

    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.

  2. TomAugspurger commented on Jul 21, 2018

    @TomAugspurger
    Member

    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.

  3. jakirkham commented on Jul 22, 2018

    @jakirkham
    MemberAuthor

    Thanks for taking a look Tom.

    Saw this locally. Though expect it could occur on CI if used a newer version of pandas in the Python 2.7 build. The buffer_put_lines function was added in PR ( pandas-dev/pandas#20341 ), which was added in 0.23.0. Currently we are using pandas 0.22.0 with Python 2.7.

  4. mrocklin commented on Oct 22, 2018

    @mrocklin
    Member

    I'm curious, what ever happened here?

  5. quasiben commented on Apr 30, 2019

    @quasiben
    Member

    @jakirkham I suspect we can close this? Do you have thoughts ?

  6. jakirkham commented on Apr 30, 2019

    @jakirkham
    MemberAuthor

    Sure, let's close this. My guess is the issue has gone away (given the age and quiet nature of this issue).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions