internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: dask/dask

Issue:
to_datetime removes _meta.index.name but does not remove the partition index names
This problem was noticed when trying to call `to_parquet` and getting a columns do not match the metadata `ValueError`. It is similar to #3003 but I believe that behavior was actually fixed for `assign` (?)


Example:
-------

in.csv:
```ix,dates
0,1900-01-01T00:00:00.000000000
1,2019-01-07T00:00:00.000000000
2,2012-04-18T00:00:00.000000000
3,2004-07-01T00:00:00.000000000
4,2010-05-12T00:00:00.000000000
```

```
import dask.dataframe as ddf
this_ddf = ddf.from_pandas(pd.read_csv('in.csv', index_col=0),npartitions=1)
this_ddf.dates = ddf.to_datetime(this_ddf.dates, format='%Y-%m-%dT%H:%M:%S')
print(this_ddf._meta.index.name, this_ddf.head().index.name)
```

The printed value is: `(None, 'ix')`. Expected result: `('ix', 'ix')`



Discussion:

Resolving patch:
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -4789,8 +4789,15 @@ def maybe_shift_divisions(df, periods, freq):
 
 
 @wraps(pd.to_datetime)
-def to_datetime(arg, **kwargs):
-    meta = pd.Series([pd.Timestamp('2000')])
+def to_datetime(arg, meta=None, **kwargs):
+    if meta is None:
+        if isinstance(arg, Index):
+            meta = pd.DatetimeIndex([])
+            meta.name = arg.name
+        else:
+            meta = pd.Series([pd.Timestamp('2000')])
+            meta.index = meta.index.astype(arg.index.dtype)
+            meta.index.name = arg.index.name
     return map_partitions(pd.to_datetime, arg, meta=meta, **kwargs)
 
 


Test patch:
diff --git a/dask/dataframe/tests/test_dataframe.py b/dask/dataframe/tests/test_dataframe.py
--- a/dask/dataframe/tests/test_dataframe.py
+++ b/dask/dataframe/tests/test_dataframe.py
@@ -3267,15 +3267,20 @@ def test_to_datetime():
     df = pd.DataFrame({'year': [2015, 2016],
                        'month': [2, 3],
                        'day': [4, 5]})
+    df.index.name = 'ix'
     ddf = dd.from_pandas(df, npartitions=2)
 
     assert_eq(pd.to_datetime(df), dd.to_datetime(ddf))
 
     s = pd.Series(['3/11/2000', '3/12/2000', '3/13/2000'] * 100)
-    ds = dd.from_pandas(s, npartitions=10)
+    s.index = s.values
+    ds = dd.from_pandas(s, npartitions=10, sort=False)
 
     assert_eq(pd.to_datetime(s, infer_datetime_format=True),
               dd.to_datetime(ds, infer_datetime_format=True))
+    assert_eq(pd.to_datetime(s.index, infer_datetime_format=True),
+              dd.to_datetime(ds.index, infer_datetime_format=True),
+              check_divisions=False)
 
 
 def test_to_timedelta():
Repository: dask/dask

Issue:
DataFrame.set_index(..., compute=False) triggers computation
According to the documentation of `DataFrame.set_index`, `compute` controls "Whether or not to trigger an immediate computation" and "Defaults to False". However, `if divisions is None`, `dask.compute` is called:

https://github.com/dask/dask/blob/0.16.0/dask/dataframe/shuffle.py#L64

As expected, if sorted divisions are provided no computation is triggered.

Depending on the complexity of the derived dataframe at hand, this sole computation of the divisions can be quite expensive and block the interpreter for a while. I acknowledge that avoiding this might be difficult, so perhaps this bit should be clarified in the documentation?


Discussion:
Sorry for the lack of response.  Yes, a documentation fix might be appropriate here.  Any interest?
I'm going to fix the documentation for this.
Great, thanks @natalya-patrikeeva! 

Resolving patch:
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -3366,7 +3366,7 @@ def set_index(
         inplace=False,
         **kwargs
     ):
-        """Set the DataFrame index (row labels) using an existing column
+        """Set the DataFrame index (row labels) using an existing column.
 
         This realigns the dataset to be sorted by a new column.  This can have a
         significant impact on performance, because joins, groupbys, lookups, etc.
@@ -3376,7 +3376,7 @@ def set_index(
         then perform many cheap computations off of the sorted dataset.
 
         This function operates exactly like ``pandas.set_index`` except with
-        different performance costs (it is much more expensive).  Under normal
+        different performance costs (dask dataframe ``set_index`` is much more expensive).  Under normal
         operation this function does an initial pass over the index column to
         compute approximate qunatiles to serve as future divisions.  It then passes
         over the data a second time, splitting up each input partition into several
@@ -3408,13 +3408,15 @@ def set_index(
             See https://docs.dask.org/en/latest/dataframe-design.html#partitions
             Defaults to computing this with a single pass over the data. Note
             that if ``sorted=True``, specified divisions are assumed to match
-            the existing partitions in the data. If this is untrue, you should
+            the existing partitions in the data. If ``sorted=False``, you should
             leave divisions empty and call ``repartition`` after ``set_index``.
         inplace : bool, optional
             Modifying the DataFrame in place is not supported by Dask.
             Defaults to False.
         compute: bool
             Whether or not to trigger an immediate computation. Defaults to False.
+            Note, that even if you set ``compute=False``, an immediate computation
+            will still be triggered if ``divisions`` is ``None``.
 
         Examples
         --------


Test patch:
Repository: dask/dask

Issue:
Raise error in to_zarr if nan chunks
Currently if a `nan` is encountered in the chunk shapes when saving `to_zarr`, we seem to pass this array to Zarr even though Zarr won't be able to save it (as the chunk shapes are unknown). Zarr does error out when this happens. However it would be better still to raise this error in Dask to make it clearer to users what is happening.  Please see [this SO question]( https://stackoverflow.com/q/57162752/3877089 ) for context.


Discussion:

Resolving patch:
diff --git a/dask/array/core.py b/dask/array/core.py
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -2770,9 +2770,21 @@ def to_zarr(
         where overwrite=True will replace the existing data.
     compute, return_stored: see ``store()``
     kwargs: passed to the ``zarr.create()`` function, e.g., compression options
+
+    Raises
+    ------
+    ValueError
+        If ``arr`` has unknown chunk sizes, which is not supported by Zarr.
+
     """
     import zarr
 
+    if np.isnan(arr.shape).any():
+        raise ValueError(
+            "Saving a dask array with unknown chunk sizes is not "
+            "currently supported by Zarr"
+        )
+
     if isinstance(url, zarr.Array):
         z = url
         if isinstance(z.store, (dict, zarr.DictStore)) and "distributed" in config.get(


Test patch:
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -3703,6 +3703,14 @@ def test_zarr_existing_array():
     assert a2.chunks == a.chunks
 
 
+def test_to_zarr_unknown_chunks_raises():
+    pytest.importorskip("zarr")
+    a = da.random.random((10,), chunks=(3,))
+    a = a[a > 0.5]
+    with pytest.raises(ValueError, match="unknown chunk sizes"):
+        a.to_zarr({})
+
+
 def test_read_zarr_chunks():
     pytest.importorskip("zarr")
     a = da.zeros((9,), chunks=(3,))
Repository: dask/dask

Issue:
If Dask.array.stats.kurtosis input has ndim==1 the flag `fisher` is ignored and assumed to be always False

If Dask.array.stats.kurtosis input has ndim==1 the flag `fisher` is ignored and assumed to be always False:

```python
import pandas as pd
import dask.dataframe as dd
from dask.array import stats as dstats
from scipy import stats as sstats

s = pd.Series(list(range(0,11)), name='series1').astype(float)
sd = dd.from_pandas(s, npartitions=2)
```

```python
s.values.ndim

# 1
```

```python
dstats.kurtosis(sd, fisher=True).compute()

# array(1.78)
```

```python
sstats.kurtosis(s, fisher=True)
# -1.22
```

This is because of the check [here](https://github.com/dask/dask/blob/3986890685cdceb50734fa051f7bf33d9300ab14/dask/array/stats.py#L264) that causes the `fisher` flag to never be evaluated

```python
    if vals.ndim == 0:
        return vals  # TODO: scalar
        # vals = vals.item()  # array scalar

    if fisher:
        return vals - 3
    else:
        return vals
        # TODO: scalar; vals = vals.item()  # array scalar
```


I'm creating a PR that fixes this issue and creates appropriate tests.


Discussion:

Resolving patch:
diff --git a/dask/array/stats.py b/dask/array/stats.py
--- a/dask/array/stats.py
+++ b/dask/array/stats.py
@@ -261,10 +261,6 @@ def kurtosis(a, axis=0, fisher=True, bias=True, nan_policy="propagate"):
         # need a version of np.place
         raise NotImplementedError("bias=False is not implemented.")
 
-    if vals.ndim == 0:
-        return vals  # TODO: scalar
-        # vals = vals.item()  # array scalar
-
     if fisher:
         return vals - 3
     else:


Test patch:
diff --git a/dask/array/tests/test_stats.py b/dask/array/tests/test_stats.py
--- a/dask/array/tests/test_stats.py
+++ b/dask/array/tests/test_stats.py
@@ -12,14 +12,22 @@
 @pytest.mark.parametrize(
     "kind, kwargs", [("skew", {}), ("kurtosis", {}), ("kurtosis", {"fisher": False})]
 )
-def test_measures(kind, kwargs):
-    x = np.random.random(size=(30, 2))
+@pytest.mark.parametrize("single_dim", [True, False])
+def test_measures(kind, kwargs, single_dim):
+    np.random.seed(seed=1337)
+    if single_dim:
+        x = np.random.random(size=(30,))
+    else:
+        x = np.random.random(size=(30, 2))
     y = da.from_array(x, 3)
     dfunc = getattr(dask.array.stats, kind)
     sfunc = getattr(scipy.stats, kind)
 
     expected = sfunc(x, **kwargs)
     result = dfunc(y, **kwargs)
+    if np.isscalar(expected):
+        # make it an array to account for possible numeric errors
+        expected = np.array(expected)
     assert_eq(result, expected)
     assert isinstance(result, da.Array)
Repository: dask/dask

Issue:
Improve warning for multiple sorted columns in parquet
See https://stackoverflow.com/questions/57345240/problem-with-opening-parquet-files-with-fastparquet-after-updating-to-latest-ver  and the conversation there by @martindurant 

I suggest a few things:

1.  Include the column names in the warning
2.  Point the user towards the `index=` keyword
3.  Tell the user that things will keep working, that this is only a warning, and that to silence the warning they should explicitly pass an index, or pass `index=None`.


Discussion:
Happy to do this, can't promise when I'll get to it.

Resolving patch:
diff --git a/dask/dataframe/io/parquet/core.py b/dask/dataframe/io/parquet/core.py
--- a/dask/dataframe/io/parquet/core.py
+++ b/dask/dataframe/io/parquet/core.py
@@ -217,7 +217,11 @@ def read_parquet(
             else:
                 # Multiple sorted columns found, cannot autodetect the index
                 warnings.warn(
-                    "Multiple sorted columns found, cannot autodetect index",
+                    "Multiple sorted columns found %s, cannot\n "
+                    "autodetect index. Will continue without an index.\n"
+                    "To pick an index column, use the index= keyword; to \n"
+                    "silence this warning use index=False."
+                    "" % [o["name"] for o in out],
                     RuntimeWarning,
                 )
                 index = False


Test patch:
diff --git a/dask/dataframe/io/tests/test_parquet.py b/dask/dataframe/io/tests/test_parquet.py
--- a/dask/dataframe/io/tests/test_parquet.py
+++ b/dask/dataframe/io/tests/test_parquet.py
@@ -1699,6 +1699,22 @@ def test_arrow_partitioning(tmpdir):
     ddf.astype({"b": np.float32}).compute()
 
 
+def test_sorted_warnings(tmpdir, engine):
+    tmpdir = str(tmpdir)
+    df = dd.from_pandas(
+        pd.DataFrame({"cola": range(10), "colb": range(10)}), npartitions=2
+    )
+    df.to_parquet(tmpdir, engine=engine, write_index=False)
+    with pytest.warns(RuntimeWarning) as record:
+        out = dd.read_parquet(tmpdir, engine=engine)
+    assert "['cola', 'colb']" in str(record[-1].message)
+    warnings = len(record)
+    assert out.columns.tolist() == ["cola", "colb"]
+    with pytest.warns(None) as record:
+        dd.read_parquet(tmpdir, engine=engine, index=False)
+    assert len(record) < warnings  # still may have some arrow warnings
+
+
 def test_informative_error_messages():
     with pytest.raises(ValueError) as info:
         dd.read_parquet("foo", engine="foo")
Repository: dask/dask

Issue:
`Array.persist` doesn't propagate `_meta` 
from https://github.com/dask/dask/issues/5313#issuecomment-524287257.


Discussion:

Resolving patch:
diff --git a/dask/array/core.py b/dask/array/core.py
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -1070,7 +1070,7 @@ def __dask_postcompute__(self):
         return finalize, ()
 
     def __dask_postpersist__(self):
-        return Array, (self.name, self.chunks, self.dtype)
+        return Array, (self.name, self.chunks, self.dtype, self._meta)
 
     @property
     def numblocks(self):


Test patch:
diff --git a/dask/array/tests/test_sparse.py b/dask/array/tests/test_sparse.py
--- a/dask/array/tests/test_sparse.py
+++ b/dask/array/tests/test_sparse.py
@@ -165,6 +165,7 @@ def test_metadata():
     assert isinstance(y[:5, ::2]._meta, sparse.COO)
     assert isinstance(y.rechunk((2, 2))._meta, sparse.COO)
     assert isinstance((y - z)._meta, sparse.COO)
+    assert isinstance(y.persist()._meta, sparse.COO)
     if IS_NEP18_ACTIVE:
         assert isinstance(np.concatenate([y, y])._meta, sparse.COO)
         assert isinstance(np.concatenate([y, y[:0], y])._meta, sparse.COO)
Repository: dask/dask

Issue:
Numpy warnings in compute_meta
I've noticed that the following (just an example) generates a warning (using dask version `2.3.0`):
```python
import dask.array as da
import numpy as np

data0 = da.zeros((3, 10, 10), chunks=(3, 2, 2))
data1 = da.map_blocks(lambda x: np.mean(x, axis=0), data0, dtype=data0.dtype, drop_axis=0)
```
Output:
```
numpy/core/fromnumeric.py:3257: RuntimeWarning: Mean of empty slice
```
This seems related to [this pull request](https://github.com/dask/dask/pull/5103).

Thanks!

<details>
dask==2.3.0
numpy==1.17.0
pkg-resources==0.0.0
toolz==0.10.0
</details>


Discussion:
Thanks @estebanag for raising an issue and providing a nice minimal example, I'm able to reproduce the `RuntimeWarning`. The changes made in #5103 are to ignore NumPy's floating-point exceptions (e.g. when dividing by 0). The warning we're seeing here, taking the mean of an empty slice, is not a floating-point exception (see the "Notes" section of the [`numpy.seterr` docs](https://docs.scipy.org/doc/numpy/reference/generated/numpy.seterr.html#numpy.seterr) for a list of NumPy's floating-point exceptions).

To ignore this warning, we would need to catch `RuntimeWarning`s more broadly in `compute_meta`. Do you have an interest in submitting a PR (no obligation though)?

Resolving patch:
diff --git a/dask/array/utils.py b/dask/array/utils.py
--- a/dask/array/utils.py
+++ b/dask/array/utils.py
@@ -5,6 +5,7 @@
 import math
 import numbers
 import os
+import warnings
 
 import numpy as np
 from toolz import frequencies, concat
@@ -108,7 +109,9 @@ def meta_from_array(x, ndim=None, dtype=None):
 
 
 def compute_meta(func, _dtype, *args, **kwargs):
-    with np.errstate(all="ignore"):
+    with np.errstate(all="ignore"), warnings.catch_warnings():
+        warnings.simplefilter("ignore", category=RuntimeWarning)
+
         args_meta = [meta_from_array(x) if is_arraylike(x) else x for x in args]
         kwargs_meta = {
             k: meta_from_array(v) if is_arraylike(v) else v for k, v in kwargs.items()


Test patch:
diff --git a/dask/array/tests/test_array_core.py b/dask/array/tests/test_array_core.py
--- a/dask/array/tests/test_array_core.py
+++ b/dask/array/tests/test_array_core.py
@@ -4080,6 +4080,11 @@ def test_auto_chunks_h5py():
 
 
 def test_no_warnings_from_blockwise():
+    with pytest.warns(None) as record:
+        x = da.ones((3, 10, 10), chunks=(3, 2, 2))
+        da.map_blocks(lambda y: np.mean(y, axis=0), x, dtype=x.dtype, drop_axis=0)
+    assert not record
+
     with pytest.warns(None) as record:
         x = da.ones((15, 15), chunks=(5, 5))
         (x.dot(x.T + 1) - x.mean(axis=0)).std()
Repository: dask/dask

Issue:
make unify_chunks public API?
It seems like it would be useful to add `xarray.unify_chunks` that calls `dask.array.core.unify_chunks`. However `unify_chunks` does not appear to be public API (https://docs.dask.org/en/latest/search.html?q=unify_chunks&check_keywords=yes&area=default)

can this be made public? 


Discussion:

Resolving patch:
diff --git a/dask/array/__init__.py b/dask/array/__init__.py
--- a/dask/array/__init__.py
+++ b/dask/array/__init__.py
@@ -19,6 +19,7 @@
         broadcast_to,
         from_zarr,
         to_zarr,
+        unify_chunks,
     )
     from .tiledb_io import from_tiledb, to_tiledb
     from .numpy_compat import rollaxis, moveaxis
diff --git a/dask/array/core.py b/dask/array/core.py
--- a/dask/array/core.py
+++ b/dask/array/core.py
@@ -3074,6 +3074,10 @@ def unify_chunks(*args, **kwargs):
     """
     Unify chunks across a sequence of arrays
 
+    This utility function is used within other common operations like
+    ``map_blocks`` and ``blockwise``.  It is not commonly used by end-users
+    directly.
+
     Parameters
     ----------
     *args: sequence of Array, index pairs


Test patch:
Repository: dask/dask

Issue:
Dask Dataframe cannot handle the lazy evaluation of dd.Scalar object in fillna
This issue is somewhat related to #1701. Discovered by @AndrewRook

#1701 reveals the issue when fillna with a dask dataframe ops. In some cases, we have to fill each column using the columnwise ops like `.mean`:

Minimal reproducible example:

```python
from pandas.util.testing import makeMissingDataframe
import dask.dataframe as dd


df_t = makeMissingDataframe(0.8, 1000)

ddf_t = dd.from_pandas(df_t, npartitions=5)

ddf_t.fillna(ddf_t.mean()).compute() # Works
ddf_t["A"].fillna(ddf_t["A"].mean().compute()).compute() # Works

ddf_t["A"].fillna(ddf_t["A"].mean()).compute() # Does not work.

```


Discussion:

Resolving patch:
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -1128,6 +1128,8 @@ def fillna(self, value=None, method=None, limit=None, axis=None):
             raise NotImplementedError("fillna with set limit and method=None")
         if isinstance(value, _Frame):
             test_value = value._meta_nonempty.values[0]
+        elif isinstance(value, Scalar):
+            test_value = value._meta_nonempty
         else:
             test_value = value
         meta = self._meta_nonempty.fillna(


Test patch:
diff --git a/dask/dataframe/tests/test_dataframe.py b/dask/dataframe/tests/test_dataframe.py
--- a/dask/dataframe/tests/test_dataframe.py
+++ b/dask/dataframe/tests/test_dataframe.py
@@ -1914,6 +1914,7 @@ def test_fillna():
 
     assert_eq(ddf.fillna(100), df.fillna(100))
     assert_eq(ddf.A.fillna(100), df.A.fillna(100))
+    assert_eq(ddf.A.fillna(ddf["A"].mean()), df.A.fillna(df["A"].mean()))
 
     assert_eq(ddf.fillna(method="pad"), df.fillna(method="pad"))
     assert_eq(ddf.A.fillna(method="pad"), df.A.fillna(method="pad"))
Repository: dask/dask

Issue:
da.array(list) returns a list
Calling `da.array()` on a list returns the argument unchanged, i.e. the output is a list, not a dask array. This is unexpected. Either the docstring should be updated to indicate this, or the function should be changed to emit an ndarray as one would expect from the current docstring.

MRE:
```
import dask.array as da
type(da.array([0,1,2,3]))
# prints `list`
```


Discussion:
Thanks for opening an issue @d-v-b. We might want to add `x = asarray(x)` at the beginning of `da.array` (several other functions in `dask/array/routines.py` do this to ensure the that input is converted to a dask array).

Resolving patch:
diff --git a/dask/array/routines.py b/dask/array/routines.py
--- a/dask/array/routines.py
+++ b/dask/array/routines.py
@@ -42,6 +42,7 @@
 
 @derived_from(np)
 def array(x, dtype=None, ndmin=None):
+    x = asarray(x)
     while ndmin is not None and x.ndim < ndmin:
         x = x[None, :]
     if dtype is not None and x.dtype != dtype:


Test patch:
diff --git a/dask/array/tests/test_routines.py b/dask/array/tests/test_routines.py
--- a/dask/array/tests/test_routines.py
+++ b/dask/array/tests/test_routines.py
@@ -23,6 +23,14 @@ def test_array():
     assert isinstance(y, da.Array)
 
 
+def test_array_return_type():
+    # Regression test for https://github.com/dask/dask/issues/5426
+    x = [0, 1, 2, 3]
+    dx = da.array(x)
+    assert isinstance(dx, da.Array)
+    assert_eq(x, dx)
+
+
 def test_derived_docstrings():
     assert "This docstring was copied from numpy.array" in da.routines.array.__doc__
     assert "Create an array." in da.routines.array.__doc__
Repository: dask/dask

Issue:
Upstream Dev failures
https://travis-ci.org/dask/dask/jobs/599328572


Discussion:
Is this related to skimage API changes ?
Looking into it now.

Resolving patch:
diff --git a/dask/dataframe/core.py b/dask/dataframe/core.py
--- a/dask/dataframe/core.py
+++ b/dask/dataframe/core.py
@@ -62,6 +62,7 @@
     is_categorical_dtype,
     has_known_categories,
     PANDAS_VERSION,
+    PANDAS_GT_100,
     index_summary,
     is_dataframe_like,
     is_series_like,
@@ -3955,16 +3956,15 @@ def apply(
         """
 
         axis = self._validate_axis(axis)
-        pandas_kwargs = {
-            "axis": axis,
-            "broadcast": broadcast,
-            "raw": raw,
-            "reduce": None,
-        }
+        pandas_kwargs = {"axis": axis, "raw": raw}
 
         if PANDAS_VERSION >= "0.23.0":
             kwds.setdefault("result_type", None)
 
+        if not PANDAS_GT_100:
+            pandas_kwargs["broadcast"] = broadcast
+            pandas_kwargs["reduce"] = None
+
         kwds.update(pandas_kwargs)
 
         if axis == 0:
diff --git a/dask/dataframe/utils.py b/dask/dataframe/utils.py
--- a/dask/dataframe/utils.py
+++ b/dask/dataframe/utils.py
@@ -35,6 +35,7 @@
 PANDAS_GT_0230 = PANDAS_VERSION >= LooseVersion("0.23.0")
 PANDAS_GT_0240 = PANDAS_VERSION >= LooseVersion("0.24.0rc1")
 PANDAS_GT_0250 = PANDAS_VERSION >= LooseVersion("0.25.0")
+PANDAS_GT_100 = PANDAS_VERSION >= LooseVersion("0.26.0.dev0")
 HAS_INT_NA = PANDAS_GT_0240
 
 


Test patch:
diff --git a/dask/array/tests/test_image.py b/dask/array/tests/test_image.py
--- a/dask/array/tests/test_image.py
+++ b/dask/array/tests/test_image.py
@@ -17,7 +17,7 @@ def random_images(n, shape):
         for i in range(n):
             fn = os.path.join(dirname, "image.%d.png" % i)
             x = np.random.randint(0, 255, size=shape).astype("u1")
-            imsave(fn, x)
+            imsave(fn, x, check_contrast=False)
 
         yield os.path.join(dirname, "*.png")
 
diff --git a/dask/dataframe/tests/test_multi.py b/dask/dataframe/tests/test_multi.py
--- a/dask/dataframe/tests/test_multi.py
+++ b/dask/dataframe/tests/test_multi.py
@@ -1252,11 +1252,17 @@ def test_cheap_single_partition_merge_on_index():
     actual = aa.merge(bb, left_index=True, right_on="x", how="inner")
     expected = a.merge(b, left_index=True, right_on="x", how="inner")
 
+    # Workaround https://github.com/pandas-dev/pandas/issues/26925
+    # actual has the correct dtype for the index (Int64). Pandas as object-dtype
+    # for empty joins.
+    expected.index = expected.index.astype("int64")
+
     assert actual.known_divisions
     assert_eq(actual, expected)
 
     actual = bb.merge(aa, right_index=True, left_on="x", how="inner")
     expected = b.merge(a, right_index=True, left_on="x", how="inner")
+    expected.index = expected.index.astype("int64")
 
     assert actual.known_divisions
     assert_eq(actual, expected)