diff --git a/modin/dataframe/dataframe.py b/modin/dataframe/dataframe.py index 88452149a71..0656cd7da97 100644 --- a/modin/dataframe/dataframe.py +++ b/modin/dataframe/dataframe.py @@ -2335,6 +2335,8 @@ def insert(self, loc, column, value, allow_duplicates=False): partition, index_within_partition = \ self._col_metadata.insert(column, loc) + index = self.index + # Deploy insert function to specific column partition, and replace that # column def insert_col_part(df): @@ -2348,8 +2350,10 @@ def insert_col_part(df): value, allow_duplicates) df.index = pandas.RangeIndex(0, len(df)) else: + df.index = index df.insert(index_within_partition, column, value, allow_duplicates) + df.index = pandas.RangeIndex(0, len(df)) return df new_obj = _deploy_func.remote(insert_col_part,