-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Table: Add methods 'join' and 'with_column' #5251
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5251 +/- ##
==========================================
+ Coverage 85.18% 85.22% +0.03%
==========================================
Files 300 300
Lines 60979 61037 +58
==========================================
+ Hits 51946 52016 +70
+ Misses 9033 9021 -12 |
Thanks for this one! 🎉 Few comments:
|
Inspired by Kotlin's convention (e.g.
Was planned. Now done.
Wow. I was writing the tests and the code in parallel, and solved some problem by using an empty array of appropriate dimensions, but I accidentally just used the same dimension as the array in tests, so |
Everybody knows that hardcoded things should be fitted to iris. Then nobody complains for a long time, because when they test the code it always works ;) I also don't particularly like the name On the other hand And finally: YAY, we are getting a method to add columns :) |
add columnOK, I'll try one last appeal: doesn't this look nice? amended = iris.with_column(label_var, label_col) As opposed to amended = iris.add_column(label_var, label_col) In the second case, I'd expect If I haven't convinced you, say so and I'm renaming it to joinI wasn't sure about But I agree on merging this with I forgot the reason for it's removal. I believe it was a mess. We probably thought it would be cleaner and didn't realize how much we'd miss it. |
I see your point, but I am somehow not used to methods describing the results, but rather the operation. For example, As for |
Decision: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably think about using the new functions (especially add_column) in the many places where it is done manually now.
We obviously don't need to wait and can merge this beforehand, after the minor changes mentioned (docstring and name).
Orange/data/table.py
Outdated
table = cls.from_numpy(domain, Xs, Ys, Ms, W, ids=tables[0].ids) | ||
for ta in reversed(table_attrss): | ||
table.attributes.update(ta) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of the new table should also be set, otherwise it is 'untitled'.
The same approach can be used as for axis=0:
names = [table.name for table in tables if table.name != "untitled"]
if names:
table.name = names[0]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I extracted the common code from _concatenate_vertical
and _concatenate_horizontal
to concatenate
.
All changes are in the second commit.
Issue
Resolves #5115.
Please comment the method names. 'join' reminds of SQL's join, but it's kind of correct.
Includes