def __setitem__(self, key: Any, value: Any) -> None:
    from pyspark.pandas.series import Series
    if (isinstance(value, (DataFrame, Series)) and (not same_anchor(value, self))):
        level = self._internal.column_labels_level
        key = DataFrame._index_normalized_label(level, key)
        value = DataFrame._index_normalized_frame(level, value)

        def assign_columns(psdf: DataFrame, this_column_labels: List[Label], that_column_labels: List[Label]) -> Iterator[Tuple[('Series', Label)]]:
            assert (len(key) == len(that_column_labels))
            for (k, this_label, that_label) in zip_longest(key, this_column_labels, that_column_labels):
                (yield (psdf._psser_for(that_label), tuple(['that', *k])))
                if ((this_label is not None) and (this_label[1:] != k)):
                    (yield (psdf._psser_for(this_label), this_label))
        psdf = align_diff_frames(assign_columns, self, value, fillna=False, how='left')
    elif isinstance(value, list):
        if (len(self) != len(value)):
            raise ValueError('Length of values does not match length of index')
        with option_context('compute.default_index_type', 'distributed-sequence', 'compute.ops_on_diff_frames', True):
            psdf = self.reset_index()
            psdf[key] = ps.DataFrame(value)
            psdf = psdf.set_index(psdf.columns[:self._internal.index_level])
            psdf.index.names = self.index.names
    elif isinstance(key, list):
        assert isinstance(value, DataFrame)
        field_names = value.columns
        psdf = self._assign({k: value[c] for (k, c) in zip(key, field_names)})
    else:
        psdf = self._assign({key: value})
    self._update_internal_frame(psdf._internal)
def __setitem__(self, key: Any, value: Any) -> None:
    from pyspark.pandas.series import Series
    if (isinstance(value, (DataFrame, Series)) and (not same_anchor(value, self))):
        level = self._internal.column_labels_level
        key = DataFrame._index_normalized_label(level, key)
        value = DataFrame._index_normalized_frame(level, value)

        def assign_columns(psdf: DataFrame, this_column_labels: List[Label], that_column_labels: List[Label]) -> Iterator[Tuple[('Series', Label)]]:
            assert (len(key) == len(that_column_labels))
            for (k, this_label, that_label) in zip_longest(key, this_column_labels, that_column_labels):
                (yield (psdf._psser_for(that_label), tuple(['that', *k])))
                if ((this_label is not None) and (this_label[1:] != k)):
                    (yield (psdf._psser_for(this_label), this_label))
        psdf = align_diff_frames(assign_columns, self, value, fillna=False, how='left')
    elif isinstance(value, list):
        if (len(self) != len(value)):
            raise ValueError('Length of values does not match length of index')
        with option_context('compute.default_index_type', 'distributed-sequence', 'compute.ops_on_diff_frames', True):
            psdf = self.reset_index()
            psdf[key] = ps.DataFrame(value)
            psdf = psdf.set_index(psdf.columns[:self._internal.index_level])
            psdf.index.names = self.index.names
    elif isinstance(key, list):
        assert isinstance(value, DataFrame)
        field_names = value.columns
        psdf = self._assign({k: value[c] for (k, c) in zip(key, field_names)})
    else:
        psdf = self._assign({key: value})
    self._update_internal_frame(psdf._internal)