Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __add__(), __iadd__() and similar to Dataset class #3449

Closed
sgraaf opened this issue Dec 17, 2021 · 2 comments
Closed

Add __add__(), __iadd__() and similar to Dataset class #3449

sgraaf opened this issue Dec 17, 2021 · 2 comments
Labels
enhancement New feature or request generic discussion Generic discussion on the library

Comments

@sgraaf
Copy link

sgraaf commented Dec 17, 2021

Is your feature request related to a problem? Please describe.
No.

Describe the solution you'd like
I would like to be able to concatenate datasets as follows:

>>> dataset["train"] += dataset["validation"]

... instead of using concatenate_datasets():

>>> raw_datasets["train"] = concatenate_datasets([raw_datasets["train"], raw_datasets["validation"]])
>>> del raw_datasets["validation"]

Describe alternatives you've considered
Well, I have considered concatenate_datasets() 😀

Additional context
N.a.

@sgraaf sgraaf added the enhancement New feature or request label Dec 17, 2021
@lhoestq lhoestq added the generic discussion Generic discussion on the library label Dec 20, 2021
@pri1311
Copy link

pri1311 commented Dec 24, 2021

I was going through the codebase, and I believe the implementation of add() and iadd() will be similar to concatenate_datasets() after the elimination of code for arguments other than the list of datasets (info, split, axis).
(Assuming elimination of axis means concatenating over axis 1.)

@mariosasko
Copy link
Collaborator

mariosasko commented Jul 25, 2023

Most data frame libraries (Polars, Pandas, etc.) override __add__ to perform (mathematical) summation, so having different behavior could lead to confusion.

@mariosasko mariosasko closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request generic discussion Generic discussion on the library
Projects
None yet
Development

No branches or pull requests

4 participants