# Buggy code
def _prepare_method(self, pandas_func, **kwargs):
    """Prepares methods given various metadata.
    Args:
        pandas_func: The function to prepare.

    Returns
        Helper function which handles potential transpose.
    """
    if self._is_transposed:

        def helper(df, internal_indices=[]):
            return pandas_func(df.T, **kwargs)

    else:

        def helper(df, internal_indices=[]):
            return pandas_func(df, **kwargs)

    return helper


# Traceback (AssertionError)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-5-7f2184cfd6d7> in <module>
2 df = pd.DataFrame(columns=cols)
3 for col in cols:
----> 4     df[col] = np.arange(10)

~/Documents/modin/modin/pandas/dataframe.py in __setitem__(self, key, value)
4605         else:
4606             loc = self.columns.get_loc(key)
-> 4607             self.__delitem__(key)
4608             self.insert(loc=loc, column=key, value=value)
4609

~/Documents/modin/modin/pandas/dataframe.py in __delitem__(self, key)
4690         if key not in self:
4691             raise KeyError(key)
-> 4692         self._update_inplace(new_query_compiler=self._query_compiler.delitem(key))
4693
4694     def __finalize__(self, other, method=None, **kwargs):

~/Documents/modin/modin/data_management/query_compiler/pandas_query_compiler.py in delitem(self, key)
2294     # These will change the shape of the resulting data.
2295     def delitem(self, key):
-> 2296         return self.drop(columns=[key])
2297
2298     def drop(self, index=None, columns=None):

~/Documents/modin/modin/data_management/query_compiler/pandas_query_compiler.py in drop(self, index, columns)
2336             new_columns = self.columns[~self.columns.isin(columns)]
2337             new_dtypes = self.dtypes.drop(columns)
-> 2338         return self.__constructor__(new_data, new_index, new_columns, new_dtypes)
2339
2340     # END __delitem__ and drop

~/Documents/modin/modin/data_management/query_compiler/pandas_query_compiler.py in __constructor__(self, block_paritions_object, index, columns, dtypes)
41     def __constructor__(self, block_paritions_object, index, columns, dtypes=None):
42         """By default, constructor method will invoke an init"""
---> 43         return type(self)(block_paritions_object, index, columns, dtypes)
44
45     # Index, columns and dtypes objects

~/Documents/modin/modin/data_management/query_compiler/pandas_query_compiler.py in __init__(self, block_partitions_object, index, columns, dtypes)
32         dtypes=None,
33     ):
---> 34         assert isinstance(block_partitions_object, BaseBlockPartitions)
35         self.data = block_partitions_object
36         self.index = index

AssertionError:

# Fixed code
def _prepare_method(self, pandas_func, **kwargs):
    """Prepares methods given various metadata.
    Args:
        pandas_func: The function to prepare.

    Returns
        Helper function which handles potential transpose.
    """
    if self._is_transposed:

        def helper(df, internal_indices=[]):
            if len(internal_indices) > 0:
                return pandas_func(df.T, internal_indices=internal_indices, **kwargs)
            return pandas_func(df.T, **kwargs)

    else:

        def helper(df, internal_indices=[]):
            if len(internal_indices) > 0:
                return pandas_func(df, internal_indices=internal_indices, **kwargs)
            return pandas_func(df, **kwargs)

    return helper