def _assign(self, kwargs: Any) -> 'DataFrame':
    assert isinstance(kwargs, dict)
    from pyspark.pandas.indexes import MultiIndex
    from pyspark.pandas.series import IndexOpsMixin
    for (k, v) in kwargs.items():
        is_invalid_assignee = ((not (isinstance(v, (IndexOpsMixin, Column)) or callable(v) or is_scalar(v))) or isinstance(v, MultiIndex))
        if is_invalid_assignee:
            raise TypeError("Column assignment doesn't support type {0}".format(type(v).__name__))
        if callable(v):
            kwargs[k] = v(self)
    pairs = {(k if is_name_like_tuple(k) else (k,)): ((v.spark.column, v._internal.data_fields[0]) if (isinstance(v, IndexOpsMixin) and (not isinstance(v, MultiIndex))) else ((v, None) if isinstance(v, Column) else (SF.lit(v), None))) for (k, v) in kwargs.items()}
    scols = []
    data_fields = []
    for label in self._internal.column_labels:
        for i in range(len(label)):
            if (label[:(len(label) - i)] in pairs):
                (scol, field) = pairs[label[:(len(label) - i)]]
                name = self._internal.spark_column_name_for(label)
                scol = scol.alias(name)
                if (field is not None):
                    field = field.copy(name=name)
                break
        else:
            scol = self._internal.spark_column_for(label)
            field = self._internal.field_for(label)
        scols.append(scol)
        data_fields.append(field)
    column_labels = self._internal.column_labels.copy()
    for (label, (scol, field)) in pairs.items():
        if (label not in set((i[:len(label)] for i in self._internal.column_labels))):
            name = name_like_string(label)
            scols.append(scol.alias(name))
            if (field is not None):
                field = field.copy(name=name)
            data_fields.append(field)
            column_labels.append(label)
    level = self._internal.column_labels_level
    column_labels = [tuple((list(label) + ([''] * (level - len(label))))) for label in column_labels]
    internal = self._internal.with_new_columns(scols, column_labels=column_labels, data_fields=data_fields)
    return DataFrame(internal)
def _assign(self, kwargs: Any) -> 'DataFrame':
    assert isinstance(kwargs, dict)
    from pyspark.pandas.indexes import MultiIndex
    from pyspark.pandas.series import IndexOpsMixin
    for (k, v) in kwargs.items():
        is_invalid_assignee = ((not (isinstance(v, (IndexOpsMixin, Column)) or callable(v) or is_scalar(v))) or isinstance(v, MultiIndex))
        if is_invalid_assignee:
            raise TypeError("Column assignment doesn't support type {0}".format(type(v).__name__))
        if callable(v):
            kwargs[k] = v(self)
    pairs = {(k if is_name_like_tuple(k) else (k,)): ((v.spark.column, v._internal.data_fields[0]) if (isinstance(v, IndexOpsMixin) and (not isinstance(v, MultiIndex))) else ((v, None) if isinstance(v, Column) else (SF.lit(v), None))) for (k, v) in kwargs.items()}
    scols = []
    data_fields = []
    for label in self._internal.column_labels:
        for i in range(len(label)):
            if (label[:(len(label) - i)] in pairs):
                (scol, field) = pairs[label[:(len(label) - i)]]
                name = self._internal.spark_column_name_for(label)
                scol = scol.alias(name)
                if (field is not None):
                    field = field.copy(name=name)
                break
        else:
            scol = self._internal.spark_column_for(label)
            field = self._internal.field_for(label)
        scols.append(scol)
        data_fields.append(field)
    column_labels = self._internal.column_labels.copy()
    for (label, (scol, field)) in pairs.items():
        if (label not in set((i[:len(label)] for i in self._internal.column_labels))):
            name = name_like_string(label)
            scols.append(scol.alias(name))
            if (field is not None):
                field = field.copy(name=name)
            data_fields.append(field)
            column_labels.append(label)
    level = self._internal.column_labels_level
    column_labels = [tuple((list(label) + ([] * (level - len(label))))) for label in column_labels]
    internal = self._internal.with_new_columns(scols, column_labels=column_labels, data_fields=data_fields)
    return DataFrame(internal)