# Dataset select function: retrieving the examples not selected

**URL:** <https://discuss.huggingface.co/t/dataset-select-function-retrieving-the-examples-not-selected/130166>\
**Category:** 🤗Datasets\
**Created:** [December 9, 2024, 10:57am UTC](https://discuss.huggingface.co/t/dataset-select-function-retrieving-the-examples-not-selected/130166 "2024-12-09T10:57:47Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kloee](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/kloee/32/37214_2.png) [@kloee](https://discuss.huggingface.co/u/kloee)\
**Post date:** [December 9, 2024, 10:57am UTC](https://discuss.huggingface.co/t/dataset-select-function-retrieving-the-examples-not-selected/130166/1 "2024-12-09T10:57:47Z")

</div>

Hi,

Is there a good way of retrieving the examples that were filtered out when using the DatasetDict.filter() function ?

For now, I’m calling filter() on a DatasetDict that way:

```auto
datasets = datasets.filter(lambda example: not example['label_kept'] in labels_to_remove)

```

For now I compute the list before for each split, but I was wondering if there’s a better way to do that. I need the id of these removed examples to compare with the original dev/test file at the end.

Thanks
