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

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fattributeerror-dataset-object-has-no-attribute-pop%2F46569%3E%5C
**Category:** Beginners\
**Created:** [July 12, 2023, 10:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fattributeerror-dataset-object-has-no-attribute-pop%2F46569 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcryptojointer)%5C
**Post date:** [July 12, 2023, 10:15am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fattributeerror-dataset-object-has-no-attribute-pop%2F46569%2F1 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FYannAgora)%5C
**Post date:** [July 12, 2023, 1:41pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fattributeerror-dataset-object-has-no-attribute-pop%2F46569%2F2 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcryptojointer)%5C
**Post date:** [July 15, 2023, 6:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fattributeerror-dataset-object-has-no-attribute-pop%2F46569%2F3 "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](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fcryptojointer)%5C
**Post date:** [July 15, 2023, 6:57am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fattributeerror-dataset-object-has-no-attribute-pop%2F46569%2F4 "2023-07-15T06:57:50Z")

</div>

# Slice and dice a dataset by hugging face :YouTube

if the link doesn’t work.
