File tree Expand file tree Collapse file tree 1 file changed +2
-3
lines changed
Expand file tree Collapse file tree 1 file changed +2
-3
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,6 @@ def pack_flat(
9393 nested_pandas.series.dtype.NestedDtype : The dtype of the output series.
9494 nested_pandas.series.packer.pack_lists : Pack a dataframe of nested arrays.
9595 """
96- original_on = on
9796 if on is not None :
9897 df = df .set_index (on )
9998 # pandas knows when index is pre-sorted, so it would do nothing if it is already sorted
@@ -103,8 +102,8 @@ def pack_flat(
103102 except ValueError :
104103 # Check if the error is due to NaN values and raise a more informative message
105104 if any (sorted_flat .index .get_level_values (i ).hasnans for i in range (sorted_flat .index .nlevels )):
106- if original_on is not None :
107- cols = [original_on ] if isinstance (original_on , str ) else list (original_on )
105+ if on is not None :
106+ cols = [on ] if isinstance (on , str ) else list (on )
108107 raise ValueError (
109108 f"Column(s) { cols } contain NaN values. "
110109 "NaN values are not supported because they cannot be used for grouping rows. "
You can’t perform that action at this time.
0 commit comments