# Buggy code
def reset_index(self, drop):
    if drop:
        exprs = OrderedDict()
        for c in self.columns:
            exprs[c] = self.ref(c)
        return self.__constructor__(
            columns=self.columns,
            dtypes=self._dtypes_for_exprs(exprs),
            op=TransformNode(self, exprs),
            index_cols=None,
            force_execution_mode=self._force_execution_mode,
        )
    else:
        if self._index_cols is None:
            raise NotImplementedError(
                "default index reset with no drop is not supported"
            )
        new_columns = Index.__new__(Index, data=self._table_cols, dtype="O")
        return self.__constructor__(
            columns=new_columns,
            dtypes=self._dtypes_for_cols(None, new_columns),
            op=self._op,
            index_cols=None,
            force_execution_mode=self._force_execution_mode,
        )


# Traceback (ValueError)
Traceback (most recent call last):
File "../reproducer.py", line 15, in <module>
md_df = pd.DataFrame(data, index=mi_index)
File "/localdisk/dchigare/repos/modin_bp/modin/pandas/dataframe.py", line 142, in __init__
self._query_compiler = from_pandas(pandas_df)._query_compiler
File "/localdisk/dchigare/repos/modin_bp/modin/pandas/utils.py", line 37, in from_pandas
return DataFrame(query_compiler=EngineDispatcher.from_pandas(df))
File "/localdisk/dchigare/repos/modin_bp/modin/data_management/factories/dispatcher.py", line 97, in from_pandas
return cls.__engine._from_pandas(df)
File "/localdisk/dchigare/repos/modin_bp/modin/data_management/factories/factories.py", line 71, in _from_pandas
return cls.io_cls.from_pandas(df)
File "/localdisk/dchigare/repos/modin_bp/modin/engines/base/io/io.py", line 31, in from_pandas
return cls.query_compiler_cls.from_pandas(df, cls.frame_cls)
File "/localdisk/dchigare/repos/modin_bp/modin/experimental/backends/omnisci/query_compiler.py", line 42, in from_pandas
return cls(data_cls.from_pandas(df))
File "/localdisk/dchigare/repos/modin_bp/modin/experimental/engines/omnisci_on_ray/frame/data.py", line 1142, in from_pandas
df = df.reset_index()
File "/localdisk/dchigare/miniconda3/envs/modin_on_omnisci/lib/python3.7/site-packages/pandas/core/frame.py", line 4854, in reset_index
new_obj.insert(0, name, level_values)
File "/localdisk/dchigare/miniconda3/envs/modin_on_omnisci/lib/python3.7/site-packages/pandas/core/frame.py", line 3623, in insert
self._mgr.insert(loc, column, value, allow_duplicates=allow_duplicates)
File "/localdisk/dchigare/miniconda3/envs/modin_on_omnisci/lib/python3.7/site-packages/pandas/core/internals/managers.py", line 1177, in insert
raise ValueError(f"cannot insert {item}, already exists")
ValueError: cannot insert __index__, already exists

# Fixed code
def reset_index(self, drop):
    if drop:
        exprs = OrderedDict()
        for c in self.columns:
            exprs[c] = self.ref(c)
        return self.__constructor__(
            columns=self.columns,
            dtypes=self._dtypes_for_exprs(exprs),
            op=TransformNode(self, exprs),
            index_cols=None,
            force_execution_mode=self._force_execution_mode,
        )
    else:
        if self._index_cols is None:
            raise NotImplementedError(
                "default index reset with no drop is not supported"
            )
        # Need to demangle index names.
        exprs = OrderedDict()
        for i, c in enumerate(self._index_cols):
            name = self._index_name(c)
            if name is None:
                name = f"level_{i}"
            if name in exprs:
                raise ValueError(f"cannot insert {name}, already exists")
            exprs[name] = self.ref(c)
        for c in self.columns:
            if c in exprs:
                raise ValueError(f"cannot insert {c}, already exists")
            exprs[c] = self.ref(c)
        new_columns = Index.__new__(Index, data=exprs.keys(), dtype="O")
        return self.__constructor__(
            columns=new_columns,
            dtypes=self._dtypes_for_exprs(exprs),
            op=TransformNode(self, exprs),
            index_cols=None,
            force_execution_mode=self._force_execution_mode,
        )