File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -6152,26 +6152,23 @@ def f(vals) -> tuple[np.ndarray, int]:
6152
6152
return labels .astype ("i8" , copy = False ), len (shape )
6153
6153
6154
6154
if subset is None :
6155
- subset = self .columns
6155
+ subset_iterable : Iterable = self .columns
6156
6156
elif (
6157
6157
not np .iterable (subset )
6158
6158
or isinstance (subset , str )
6159
6159
or isinstance (subset , tuple )
6160
6160
and subset in self .columns
6161
6161
):
6162
- subset = (subset ,)
6163
-
6164
- # needed for mypy since can't narrow types using np.iterable
6165
- subset = cast (Iterable , subset )
6162
+ subset_iterable = (subset ,)
6166
6163
6167
6164
# Verify all columns in subset exist in the queried dataframe
6168
6165
# Otherwise, raise a KeyError, same as if you try to __getitem__ with a
6169
6166
# key that doesn't exist.
6170
- diff = Index (subset ).difference (self .columns )
6167
+ diff = Index (subset_iterable ).difference (self .columns )
6171
6168
if not diff .empty :
6172
6169
raise KeyError (diff )
6173
6170
6174
- vals = (col .values for name , col in self .items () if name in subset )
6171
+ vals = (col .values for name , col in self .items () if name in subset_iterable )
6175
6172
labels , shape = map (list , zip (* map (f , vals )))
6176
6173
6177
6174
ids = get_group_index (
You can’t perform that action at this time.
0 commit comments