Bug: adds support for unary plus
State: closed

- [ ] closes #16073
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry

Adds missing unary plus operator from #16073. Adds typechecking behavior to unary neg, along with tests for both.

Labels:
name: Enhancement
name: Dtype Conversions
description: Unexpected or buggy dtype conversions
name: Numeric Operations
description: Arithmetic, Comparison, and Logical operations

Comments:
From the CI logs, it looks like the new operator trips some of the computational tests for other dtypes. I can clean these up, but would like to ask for some guidance on how we would like to handle operations on the timeperiod dtypes.
Hello @deniederhut! Thanks for updating the PR.











Cheers ! There are no PEP8 issues in this Pull Request. :beers: 

##### Comment last updated on February 08, 2018 at 01:18 Hours UTC
@deniederhut 

@jbrockmendel has been working a lot on the ops recently. what cases are in question? can you show (alternativley, you can xfail them and then point them out in your diff).
`TestSeriesPeriod.test_ops_series_period` and `TestFramePeriod.test_ops_frame_period` both had unary negatives which are currently not allowed for TimePeriod objects, such as:

```python
tm.assert_series_equal(s - p, -exp)
```

Do we want to allow these?

`TestEvalPythonPython.test_frame_pos` and `TestEvalPythonPython.test_series_pos` are both testing to ensure that a unary plus always raises, even with numeric data. My assumption is that these would be okay to remove, since they are testing for the nonexistence of the feature this PR implements.
@jreback would it be better to defer the decision about TimePeriods, and xfail the problematic tests for now?
yes, ok with fixing Timedelta / periods after. pls put in the appopriate xfails. and rebase.
@jreback It's not clear to me why the Travis build is failing -- there are some warnings about IPython versions and SparseBlocks, but no failed tests. Is there something obvious that I am missing?
you are failing linting

see the very end
🤦‍♀️ yup there it is. Thanks!
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=h1) Report
> Merging [#19297](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/affb5d91555a4d4e57e7ca3696ecc2187d3ddb32?src=pr&el=desc) will **increase** coverage by `<.01%`.
> The diff coverage is `100%`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/19297/graphs/tree.svg?width=650&height=150&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #19297      +/-   ##
==========================================
+ Coverage   91.62%   91.62%   +<.01%     
==========================================
  Files         150      150              
  Lines       48773    48790      +17     
==========================================
+ Hits        44687    44704      +17     
  Misses       4086     4086
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.99% <100%> (ø)` | :arrow_up: |
| #single | `41.73% <9.09%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/19297/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `95.93% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/19297/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `97.26% <0%> (-0.26%)` | :arrow_down: |
| [pandas/core/reshape/merge.py](https://codecov.io/gh/pandas-dev/pandas/pull/19297/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzaGFwZS9tZXJnZS5weQ==) | `94.25% <0%> (+0.03%)` | :arrow_up: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/19297/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `94.87% <0%> (+0.13%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=footer). Last update [affb5d9...2b8072e](https://codecov.io/gh/pandas-dev/pandas/pull/19297?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

thanks @deniederhut nice patch! sometimes little issues can morph, nice job!
Thanks so much for your help @jreback !