AttributeError: 'Dataset' object has no attribute 'pop'
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.
2023-07-12T13:41:23Z
Hello thereTo remove features in a Dataset you need to use the.remove_columns()method. Dochere.
2023-07-15T06:57:00Z
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.
2023-07-15T06:57:50Z
Slice and dice a dataset by hugging face :YouTubeif the link doesn’t work.