Skip to content

Commit

Permalink
convert native pandas index to snowpark pandas index before reindex
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-vbudati committed Aug 28, 2024
1 parent ad836c1 commit 74f6d15
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2373,7 +2373,9 @@ def _reindex_axis_0(
"""
self._raise_not_implemented_error_for_timedelta()

if isinstance(labels, (pd.Index)):
if isinstance(labels, native_pd.Index):
labels = pd.Index(labels)
if isinstance(labels, pd.Index):
new_index_qc = labels.to_series()._query_compiler
else:
new_index_qc = pd.Series(labels)._query_compiler
Expand Down Expand Up @@ -2461,20 +2463,12 @@ def _reindex_axis_0(
data_column_snowflake_quoted_identifiers.remove(
monotonic_increasing_snowflake_quoted_id
)
# When we create an unnamed Series, the default name is set to "__reduced__" in the internal frame.
# Don't copy this name to the new frame unless Series has an actual name set.
index_column_pandas_labels = (
[None]
if new_index_modin_frame.data_column_pandas_labels
== [MODIN_UNNAMED_SERIES_LABEL]
else new_index_modin_frame.data_column_pandas_labels
)
new_modin_frame = InternalFrame.create(
ordered_dataframe=result_frame.ordered_dataframe,
data_column_pandas_labels=data_column_pandas_labels,
data_column_snowflake_quoted_identifiers=data_column_snowflake_quoted_identifiers,
data_column_pandas_index_names=modin_frame.data_column_pandas_index_names,
index_column_pandas_labels=index_column_pandas_labels,
index_column_pandas_labels=new_index_modin_frame.index_column_pandas_labels,
index_column_snowflake_quoted_identifiers=result_frame_column_mapper.map_left_quoted_identifiers(
new_index_modin_frame.data_column_snowflake_quoted_identifiers
),
Expand Down

0 comments on commit 74f6d15

Please sign in to comment.