-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Unary plus feature #16103
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
Unary plus feature #16103
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.
One additional concern: unary +
should only be defined defined for numeric types that can represent signed quantities (including timedelta). For datetime and strings, it should raise TypeError.
Finally, note that implementing this is a little more complicated that writing +_values_from_object(self)
, because unfortunately numpy does not implement unary + correctly, either (numpy/numpy#8967).
@@ -838,8 +838,7 @@ def _set_axis_name(self, name, axis=0): | |||
1 2 | |||
2 3 | |||
>>> df.index = pd.MultiIndex.from_product([['A'], ['a', 'b', 'c']]) | |||
>>> df._set_axis_name(["bar", "baz"]) | |||
A | |||
>>> df._set_axis_name(["bar", "baz"]) A |
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.
This shouldn't be changed
@@ -91,6 +91,9 @@ def check(series, other, check_reverse=False): | |||
check(self.ts, 5, check_reverse=True) | |||
check(tm.makeFloatSeries(), tm.makeFloatSeries(), check_reverse=True) | |||
|
|||
def test_pos(self): | |||
assert_series_equal(+self.series, self.series) |
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.
need to add a test for dataframes, too
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.
Sorry, I'm new to contributing to this Pandas. Are there any other datatypes that I need to write test cases for other than series and dataframes?
I'll write these tests and resubmit tomorrow.
Thanks for the feedback! I made a lot of embarrassing small mistakes in this pull request that I'll fix and resubmit. Regarding the concern about which values the Ideally |
Just in case you don't know, for resubmitting, you just have to push to the same branch and this PR will be updated (no need to submit a new PR) |
That's a bit of an issue. I was messing around and really broke that branch so I made a new one. I will definitely keep that in mind in the future and for now I'll link to the new branch in this thread when I submit the new PR. Hopefully it won't be too confusing if anyone looks in this thread later |
You can rename your branch locally to the original name, that will work as well to update this PR |
I attempted to rename the branch but something went wrong. The new PR is here: #16106 Sorry for the inconvenience. |
git diff upstream/master --name-only -- '*.py' | flake8 --diff