Skip to content

Commit

Permalink
avoid explicit pandas checks in merge
Browse files Browse the repository at this point in the history
  • Loading branch information
mrocklin committed Feb 24, 2019
1 parent 429f0be commit a37c4cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dask/dataframe/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
from toolz import merge_sorted, unique, first
import pandas as pd

from ..base import tokenize
from ..base import tokenize, is_dask_collection
from ..compatibility import apply
from ..highlevelgraph import HighLevelGraph
from .core import (_Frame, DataFrame, Series, map_partitions, Index,
Expand Down Expand Up @@ -335,14 +335,14 @@ def merge(left, right, how='inner', on=None, left_on=None, right_on=None,
indicator=indicator)

# Transform pandas objects into dask.dataframe objects
if isinstance(left, (pd.Series, pd.DataFrame)):
if not is_dask_collection(left):
if right_index and left_on: # change to join on index
left = left.set_index(left[left_on])
left_on = False
left_index = True
left = from_pandas(left, npartitions=1) # turn into DataFrame

if isinstance(right, (pd.Series, pd.DataFrame)):
if not is_dask_collection(right):
if left_index and right_on: # change to join on index
right = right.set_index(right[right_on])
right_on = False
Expand Down

0 comments on commit a37c4cd

Please sign in to comment.