-
Notifications
You must be signed in to change notification settings - Fork 6
Rename replace_axes as set_axes + update doc of rename method #147
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
Rename replace_axes as set_axes + update doc of rename method #147
Conversation
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 release notes in the other PR will need to be updated too
larray/core.py
Outdated
@@ -4319,6 +4328,10 @@ def rename(self, renames=None, to=None, **kwargs): | |||
nat2\\sex2 | M | F | |||
BE | 0 | 1 | |||
FO | 2 | 3 | |||
>>> arr.rename({'nat': 'nat2', 'sex': 'sex2'}) |
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.
duh? this is the same as the previous example?
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.
It was to test the inplace flag. I failded to properly clean the examples.
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.
:)
@@ -3905,7 +3905,7 @@ def __init__(self, | |||
raise ValueError("length of axes %s does not match " | |||
"data shape %s" % (axes.shape, data.shape)) | |||
|
|||
# Because __getattr__ and __setattr__ have been rewritten | |||
# Because __getattr__ and __setattr__ have been overridden |
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.
even though it is indeed the case, __setattr__
should actually not be overridden (ever since we changed __getattr__
to return axes). It might be better to fix that in a separate PR though, because most (all?) object.__setattr__
could/should be replaced.
larray/core.py
Outdated
@@ -3976,28 +3973,37 @@ def replace_axes(self, axes_to_replace=None, new_axis=None, **kwargs): | |||
a1 | 3 | 4 | 5 | |||
>>> row = Axis('row', ['r0', 'r1']) | |||
>>> column = Axis('column', ['c0', 'c1', 'c2']) | |||
>>> arr.replace_axes(x.a, row) | |||
|
|||
Replace one axis (expect 2 arguments) |
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 "expect 2 arguments" part is a bit strange. who should expect? the function or the user? => replace by somethng like:
Replace one axis (the second argument is required when using this syntax)
fix larray-project#133 :Rename replace_axes as set_axes. Add inplace flag to set_axes and rename methods
a0bd8c8
to
a139f99
Compare
LGTM |
fix #121 : Update docstring of set_labels.
fix #133 : Rename replace_axes as set_axes.
Add inplace flag to set_axes and rename methods