# AttributeError: 'Dataset' object has no attribute 'pop'

**URL:** <https://discuss.huggingface.co/t/attributeerror-dataset-object-has-no-attribute-pop/46569>\
**Category:** Beginners\
**Created:** [July 12, 2023, 10:15am UTC](https://discuss.huggingface.co/t/attributeerror-dataset-object-has-no-attribute-pop/46569 "2023-07-12T10:15:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cryptojointer](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@cryptojointer](https://discuss.huggingface.co/u/cryptojointer)\
**Post date:** [July 12, 2023, 10:15am UTC](https://discuss.huggingface.co/t/attributeerror-dataset-object-has-no-attribute-pop/46569/1 "2023-07-12T10:15:28Z")

</div>

I keep receiving this error, with whatever i try and do to a dataset dictionary that i downloaded from hugging face. I want to remove certain features from the dictionary and just keep a few. (base\_prompt, best\_answer)

features\_kept = [‘base\_prompt’, ‘best\_answer’]  
test\_set\_new = {key: value for key, value in test\_reloaded.items() if key in features\_kept}

second error:  
AttributeError: ‘Dataset’ object has no attribute ‘pop’

code:  
prompt\_removed = test\_reloaded.pop(‘base\_prompt’)  
answer\_removed = test\_reloaded.pop(‘best\_answer’)

I can seem to figure out how to solve?

Any help would be much appreciated. Thank you.

---

<div class="post-metadata">

**Author:** ![YannAgora](https://avatars.discourse-cdn.com/v4/letter/y/c0e974/32.png) [@YannAgora](https://discuss.huggingface.co/u/YannAgora)\
**Post date:** [July 12, 2023, 1:41pm UTC](https://discuss.huggingface.co/t/attributeerror-dataset-object-has-no-attribute-pop/46569/2 "2023-07-12T13:41:23Z")

</div>

Hello there 👋

To remove features in a Dataset you need to use the `.remove_columns()` method. Doc [here](https://huggingface.co/docs/datasets/process#remove).

---

<div class="post-metadata">

**Author:** ![cryptojointer](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@cryptojointer](https://discuss.huggingface.co/u/cryptojointer)\
**Post date:** [July 15, 2023, 6:57am UTC](https://discuss.huggingface.co/t/attributeerror-dataset-object-has-no-attribute-pop/46569/3 "2023-07-15T06:57:00Z")

</div>

Thank you so much! I’ve actually just found a hugging face video aswell!

For anyone, who wants to learn this and other things relating to changing datasetDicts hugging face have made a great video. Hope this helps.

https://www.youtube.com/embed/tqfSFcPMgOI?feature=oembed&wmode=opaque&list=PLCMq0KTFpAHOUkZl81eYGxxRo4UI40Mr7

---

<div class="post-metadata">

**Author:** ![cryptojointer](https://avatars.discourse-cdn.com/v4/letter/c/b38774/32.png) [@cryptojointer](https://discuss.huggingface.co/u/cryptojointer)\
**Post date:** [July 15, 2023, 6:57am UTC](https://discuss.huggingface.co/t/attributeerror-dataset-object-has-no-attribute-pop/46569/4 "2023-07-15T06:57:50Z")

</div>

# Slice and dice a dataset by hugging face :YouTube

if the link doesn’t work.
