Skip to content

Commit

Permalink
Resolve review
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Mar 21, 2024
1 parent 19f397f commit 0d72d90
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ipydatagrid/datagrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,8 @@ def _get_row_index_of_primary_key(self, value):
"as the primary key."
)

# TODO Is there a better way for this?
row_indices = [
idx
for idx, row in self._data["data"].iterrows()
if all(row[key[j]] == value[j] for j in range(len(key)))
]
return row_indices
df = self._data["data"]
return pd.RangeIndex(len(df))[(df[key] == value).all(axis="columns")].to_list()

@staticmethod
def _get_cell_value_by_numerical_index(data, column_index, row_index):
Expand Down

0 comments on commit 0d72d90

Please sign in to comment.