# Buggy code
def __call__(self, target: DataFrame, value):
    inputs = [target]
    if np.isscalar(value):
        value_dtype = np.array(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 (TypeError)
In [1]: import mars.dataframe as md

In [2]: import mars.tensor as mt

In [3]: df = md.DataFrame(mt.random.rand(10 ,3))

In [4]: df['a'] = df[0].mean()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-fdfc58da199a> in <module>
----> 1 df['a'] = df[0].mean()

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

~/Workspace/mars/mars/utils.py in _inner(*args, **kwargs)
449         def _inner(*args, **kwargs):
450             with self:
--> 451                 return func(*args, **kwargs)
452
453         return _inner

~/Workspace/mars/mars/dataframe/indexing/setitem.py in __call__(self, target, value)
69                 value_dtype = value.dtype
70             elif is_list_like(value) or isinstance(value, TENSOR_TYPE):
---> 71                 value = asseries(value, index=target.index)
72                 inputs.append(value)
73                 value_dtype = value.dtype

~/Workspace/mars/mars/dataframe/initializer.py in __init__(self, data, index, dtype, name, copy, chunk_size, gpu, sparse)
66             if chunk_size is not None:
67                 data = data.rechunk(chunk_size)
---> 68             series = series_from_tensor(data, index=index, name=name, gpu=gpu, sparse=sparse)
69         elif isinstance(index, INDEX_TYPE):
70             series = series_from_tensor(astensor(data, chunk_size=chunk_size), index=index,

~/Workspace/mars/mars/dataframe/datasource/from_tensor.py in series_from_tensor(tensor, index, name, gpu, sparse)
467 def series_from_tensor(tensor, index=None, name=None, gpu=None, sparse=False):
468     if tensor.ndim > 1 or tensor.ndim <= 0:
--> 469         raise TypeError(f'Not support create DataFrame from {tensor.ndim} dims tensor')
470     gpu = tensor.op.gpu if gpu is None else gpu
471     op = SeriesFromTensor(dtype=tensor.dtype, gpu=gpu, sparse=sparse)

TypeError: Not support create DataFrame from 0 dims tensor

# Fixed 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