Skip to content

[upstream/build] missing newline after info() call on empty dataframe  #8726

@ncclementi

Description

@ncclementi

Currently the test test_dataframe.py::test_info fails on the upstream build because there is a pandas upstream PR merged that now includes a newline \n see pandas-dev/pandas#45498

Minimal Reproducible Example :

from io import StringIO
import pandas as pd
import dask.dataframe as dd

df_empty = pd.DataFrame()
ddf_empty = dd.from_pandas(df_empty, npartitions=4)

buf_pd, buf_da = StringIO(), StringIO()

df_empty.info(buf=buf_pd, memory_usage=True)
ddf_empty.info(buf=buf_da, verbose=True, memory_usage=True)

stdout_pd = buf_pd.getvalue()
stdout_da = buf_da.getvalue()
stdout_da = stdout_da.replace(str(type(ddf)), str(type(df))) # as done in `_assert_info()`

Notice that thepandasoutput has a \n at the end.

>>> stdout_pd 
"<class 'pandas.core.frame.DataFrame'>\nIndex: 0 entries\nEmpty DataFrame\n"

>>> stdout_da 
"<class 'dask.dataframe.core.DataFrame'>\nIndex: 0 entries\nEmpty DataFrame"

Software versions:
dask: main
pandas: '1.5.0.dev0+359.g03fef5f0e3'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions