Fixed Pandas Loc Row MultiIndex DataFrame to handle a case where only the first index is specified when the DataFrame has MultiIndex.
This commit is contained in:
@@ -58,10 +58,14 @@ class PandasLocRowMultiIndexDataFrame:
|
||||
# This will throw an exception if the MultiIndex is not an int.
|
||||
if row_index_type == "int":
|
||||
ind_list = [int(ind) for ind in ind_list]
|
||||
|
||||
ind_tuple = tuple(ind_list)
|
||||
|
||||
ind_tuple = tuple(ind_list) # Convert the list to a tuple
|
||||
if len(ind_tuple) == 1: # Do not enclose in tuple if only 1 index is specified
|
||||
ind = ind_tuple[0]
|
||||
else:
|
||||
ind = ind_tuple
|
||||
|
||||
# We need to wrap it to get the DataFrame. Otherwise, we will get a Series.
|
||||
ind_tuple_list = [ind_tuple]
|
||||
value = dataframe.loc[ind_tuple_list]
|
||||
ind_list = [ind]
|
||||
value = dataframe.loc[ind_list]
|
||||
return (value,)
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "data-analysis"
|
||||
description = "Data analysis custom modules for ComfyUI - Use Pandas & Matplotlib within ComfyUI"
|
||||
version = "1.1.16"
|
||||
version = "1.1.17"
|
||||
license = {file = "LICENSE"}
|
||||
|
||||
[project.urls]
|
||||
|
||||
Reference in New Issue
Block a user