# Buggy code
def insert(self, loc, column, value, allow_duplicates=False):
    if isinstance(value, (DataFrame, pandas.DataFrame)):
        if len(value.columns) != 1:
            raise ValueError("Wrong number of items passed 2, placement implies 1")
        value = value.iloc[:, 0]

    if isinstance(value, Series):
        # TODO: Remove broadcast of Series
        value = value._to_pandas()

    if not self._query_compiler.lazy_execution and len(self.index) == 0:
        try:
            value = pandas.Series(value)
        except (TypeError, ValueError, IndexError):
            raise ValueError(
                "Cannot insert into a DataFrame with no defined index "
                "and a value that cannot be converted to a "
                "Series"
            )
        new_index = value.index.copy()
        new_columns = self.columns.insert(loc, column)
        new_query_compiler = DataFrame(
            value, index=new_index, columns=new_columns
        )._query_compiler
    elif len(self.columns) == 0 and loc == 0:
        new_query_compiler = DataFrame(
            data=value, columns=[column], index=self.index
        )._query_compiler
    else:
        if (
            is_list_like(value)
            and not isinstance(value, pandas.Series)
            and len(value) != len(self.index)
        ):
            raise ValueError("Length of values does not match length of index")
        if not allow_duplicates and column in self.columns:
            raise ValueError("cannot insert {0}, already exists".format(column))
        if loc > len(self.columns):
            raise IndexError(
                "index {0} is out of bounds for axis 0 with size {1}".format(
                    loc, len(self.columns)
                )
            )
        if loc < 0:
            raise ValueError("unbounded slice")
        new_query_compiler = self._query_compiler.insert(loc, column, value)

    self._update_inplace(new_query_compiler=new_query_compiler)


# Traceback (TypeError)
Traceback (most recent call last):
File "test_outer.py", line 13, in <module>
md_df["b"] = pd.Series(np.zeros(len(md_df))) # TypeError
File "/localdisk/dchigare/repos/modin_bp/modin/pandas/dataframe.py", line 1978, in __setitem__
join="left",
File "/localdisk/dchigare/repos/modin_bp/modin/backends/pandas/query_compiler.py", line 303, in concat
new_modin_frame = self._modin_frame._concat(axis, other_modin_frame, join, sort)
File "/localdisk/dchigare/repos/modin_bp/modin/engines/base/frame/data.py", line 1850, in _concat
axis ^ 1, others, how, sort, force_repartition=True
File "/localdisk/dchigare/repos/modin_bp/modin/engines/base/frame/data.py", line 1701, in _copartition
joined_index = self._join_index_objects(axis, index_other_obj, how, sort)
File "/localdisk/dchigare/repos/modin_bp/modin/engines/base/frame/data.py", line 980, in _join_index_objects
joined_obj = merge_index(joined_obj, obj)
File "/localdisk/dchigare/repos/modin_bp/modin/engines/base/frame/data.py", line 974, in merge_index
return obj1.join(obj2, how=how, sort=sort)
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/core/indexes/datetimelike.py", line 893, in join
sort=sort,
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3483, in join
return this.join(other, how=how, return_indexers=return_indexers)
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3494, in join
other, how=how, return_indexers=return_indexers
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 3815, in _join_monotonic
join_index, lidx, ridx = self._left_indexer(sv, ov)
File "/localdisk/dchigare/miniconda3/envs/modin_tests/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 257, in _left_indexer
return libjoin.left_join_indexer(left, right)
File "pandas/_libs/join.pyx", line 357, in pandas._libs.join.left_join_indexer
TypeError: '<' not supported between instances of 'Timestamp' and 'int'

# Fixed code
def insert(self, loc, column, value, allow_duplicates=False):
    if isinstance(value, (DataFrame, pandas.DataFrame)):
        if len(value.columns) != 1:
            raise ValueError("Wrong number of items passed 2, placement implies 1")
        value = value.squeeze(axis=1)

    if not self._query_compiler.lazy_execution and len(self.index) == 0:
        if not hasattr(value, "index"):
            try:
                value = pandas.Series(value)
            except (TypeError, ValueError, IndexError):
                raise ValueError(
                    "Cannot insert into a DataFrame with no defined index "
                    "and a value that cannot be converted to a "
                    "Series"
                )
        new_index = value.index.copy()
        new_columns = self.columns.insert(loc, column)
        new_query_compiler = DataFrame(
            value, index=new_index, columns=new_columns
        )._query_compiler
    elif len(self.columns) == 0 and loc == 0:
        new_query_compiler = DataFrame(
            data=value, columns=[column], index=self.index
        )._query_compiler
    else:
        if (
            is_list_like(value)
            and not isinstance(value, (pandas.Series, Series))
            and len(value) != len(self.index)
        ):
            raise ValueError("Length of values does not match length of index")
        if not allow_duplicates and column in self.columns:
            raise ValueError("cannot insert {0}, already exists".format(column))
        if loc > len(self.columns):
            raise IndexError(
                "index {0} is out of bounds for axis 0 with size {1}".format(
                    loc, len(self.columns)
                )
            )
        if loc < 0:
            raise ValueError("unbounded slice")
        if isinstance(value, Series):
            value = value._query_compiler
        new_query_compiler = self._query_compiler.insert(loc, column, value)

    self._update_inplace(new_query_compiler=new_query_compiler)