# Buggy code
def __call__(self, target: DataFrame, value):
    inputs = [target]
    if np.isscalar(value):
        value_dtype = np.array(value).dtype
    elif self._is_scalar_tensor(value):
        inputs.append(value)
        value_dtype = value.dtype
    else:
        if isinstance(value, (pd.Series, SERIES_TYPE)):
            value = asseries(value)
            inputs.append(value)
            value_dtype = value.dtype
        elif is_list_like(value) or isinstance(value, TENSOR_TYPE):
            value = asseries(value, index=target.index)
            inputs.append(value)
            value_dtype = value.dtype
        else:  # pragma: no cover
            raise TypeError(
                "Wrong value type, could be one of scalar, Series or tensor"
            )

        if value.index_value.key != target.index_value.key:  # pragma: no cover
            raise NotImplementedError(
                "Does not support setting value with different index for now"
            )

    index_value = target.index_value
    dtypes = target.dtypes.copy(deep=True)
    dtypes.loc[self._indexes] = value_dtype
    columns_value = parse_index(dtypes.index, store_data=True)
    ret = self.new_dataframe(
        inputs,
        shape=(target.shape[0], len(dtypes)),
        dtypes=dtypes,
        index_value=index_value,
        columns_value=columns_value,
    )
    target.data = ret.data


# Traceback (NotImplementedError)
In [52]: df = md.DataFrame(index=[1, 2, 3])

In [53]: df['a'] = md.Series(['a', 'b', 'c'], index=[2, 3, 4])
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-53-f550a59ef82c> in <module>
----> 1 df['a'] = md.Series(['a', 'b', 'c'], index=[2, 3, 4])

~/Workspace/mars/mars/dataframe/indexing/setitem.py in dataframe_setitem(df, col, value)
182 def dataframe_setitem(df, col, value):
183     op = DataFrameSetitem(target=df, indexes=col, value=value)
--> 184     return op(df, value)

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
457         @functools.wraps(func)
458         def _inner(*args, **kwargs):
--> 459             with self:
460                 return func(*args, **kwargs)
461

~/Workspace/mars/mars/dataframe/indexing/setitem.py in __call__(self, target, value)
83
84             if value.index_value.key != target.index_value.key:  # pragma: no cover
---> 85                 raise NotImplementedError('Does not support setting value '
86                                           'with different index for now')
87

NotImplementedError: Does not support setting value with different index for now

# Fixed code
def __call__(self, target: DataFrame, value):
    raw_target = target

    inputs = [target]
    if np.isscalar(value):
        value_dtype = np.array(value).dtype
    elif self._is_scalar_tensor(value):
        inputs.append(value)
        value_dtype = value.dtype
    else:
        if isinstance(value, (pd.Series, SERIES_TYPE)):
            value = asseries(value)
            value_dtype = value.dtype
        elif is_list_like(value) or isinstance(value, TENSOR_TYPE):
            value = asseries(value, index=target.index)
            value_dtype = value.dtype
        else:  # pragma: no cover
            raise TypeError(
                "Wrong value type, could be one of scalar, Series or tensor"
            )

        if target.shape[0] == 0:
            # target empty, reindex target first
            target = target.reindex(value.index)
            inputs[0] = target
        elif value.index_value.key != target.index_value.key:
            # need reindex when target df is not empty and index different
            value = value.reindex(target.index)
        inputs.append(value)

    index_value = target.index_value
    dtypes = target.dtypes.copy(deep=True)
    dtypes.loc[self._indexes] = value_dtype
    columns_value = parse_index(dtypes.index, store_data=True)
    ret = self.new_dataframe(
        inputs,
        shape=(target.shape[0], len(dtypes)),
        dtypes=dtypes,
        index_value=index_value,
        columns_value=columns_value,
    )
    raw_target.data = ret.data