-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
EnhancementNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode
Milestone
Description
DataFrame.lookup
was deprecated in #35224 in 1.2. After some feedback (#39171 ) I opened this ticket to discuss re-implentation of lookup in a performant way. As mentioned in the discussion on 35244: "but it would have to be performant and not be yet another indexing api".
This ticket can be a starting point for proposed methods, although the old implementation was actually quite performant look at given tests in the discussion of 35244:
Lines 3848 to 3861 in b5958ee
if not self._is_mixed_type or n > thresh: | |
values = self.values | |
ridx = self.index.get_indexer(row_labels) | |
cidx = self.columns.get_indexer(col_labels) | |
if (ridx == -1).any(): | |
raise KeyError("One or more row labels was not found") | |
if (cidx == -1).any(): | |
raise KeyError("One or more column labels was not found") | |
flat_index = ridx * len(self.columns) + cidx | |
result = values.flat[flat_index] | |
else: | |
result = np.empty(n, dtype="O") | |
for i, (r, c) in enumerate(zip(row_labels, col_labels)): | |
result[i] = self._get_value(r, c) |
joshlk, felixpatzelt, challisd, batterseapower, Nishan-Pradhan and 4 more
Metadata
Metadata
Labels
EnhancementNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further actionReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, Explode