API: Unify .update to generic
State: closed

- [x] closes #22358 / #23585 / #23606 
- [x] tests pass unmodified
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [x] whatsnew entry

Since #22286 and #21855 have stalled completely, I've decided to go ahead with this independently.


Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Clean

Comments:
Hello @h-vetinari! Thanks for updating the PR.

 - There are no PEP8 issues in the file [`pandas/core/frame.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/core/frame.py) !

 - There are no PEP8 issues in the file [`pandas/core/generic.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/core/generic.py) !

 - There are no PEP8 issues in the file [`pandas/core/missing.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/core/missing.py) !

 - There are no PEP8 issues in the file [`pandas/core/panel.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/core/panel.py) !

 - There are no PEP8 issues in the file [`pandas/core/series.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/core/series.py) !

 - There are no PEP8 issues in the file [`pandas/tests/frame/test_combine_concat.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/tests/frame/test_combine_concat.py) !

 - There are no PEP8 issues in the file [`pandas/tests/series/test_combine_concat.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/tests/series/test_combine_concat.py) !

 - There are no PEP8 issues in the file [`pandas/tests/test_panel.py`](https://github.com/h-vetinari/pandas/blob/f66727efc69a52e4e3d24b375c84071fe3a62963/pandas/tests/test_panel.py) !



##### Comment last updated on November 11, 2018 at 10:14 Hours UTC
also have a look at #3025 
@jreback 
Thanks for the review, I'll incorporate it (resp. answer in detail) later. However, this might need a precursor PR to add tests for `Series.update` - the dtype change for 
```
>>> s = pd.Series([1, 2, 3])
>>> s.update(pd.Series([4, np.nan, 6]))
```
only got caught by the doctests. Are we fine with changing that?
let's make first pass that doesn't change anything, xfail new tests if needed for https://github.com/pandas-dev/pandas/pull/23192#issuecomment-430507189.

I would try the approach for #3025 as an alternative
Split off the dtype promotion tests for Series (which are already passing on master) off into a precursor: #23604
@h-vetinari I'm canceling the the old azure builds for this PR as you add new commits (azure auto-cancel is not working at the moment). Shouldn't make a difference to you, as I guess you just care about the last version, but ping me if this causes you any trouble.
@jreback 
I already split off #23604, but everything else comes directly out of your review. Let's deal with #23604 first though.
Though I guess I could split off solving #23606 if I first xfail the tests for #23604 (which represent the current state of `Series.update`) in this PR
Both this PR and #22225 have had persistent a `ResourceWarning` the last few runs. I first thought it was a flaky thing like those Warnings used to be, but this time, it stayed, and I can reproduce it locally (not with `pytest pandas/tests/io/test_parquet.py`, but at least with `pytest pandas/tests/io`).

For example in https://travis-ci.org/pandas-dev/pandas/jobs/453820311 or https://travis-ci.org/pandas-dev/pandas/jobs/453822449:
```
sys:1: ResourceWarning: unclosed <socket.socket fd=16, family=AddressFamily.AF_INET, type=2050, proto=0, laddr=('0.0.0.0', 0)>
sys:1: ResourceWarning: unclosed <socket.socket fd=15, family=AddressFamily.AF_INET, type=2050, proto=0, laddr=('0.0.0.0', 0)>
```
and 
```
=============================== warnings summary ===============================
pandas/core/frame.py::pandas.core.frame.DataFrame.to_parquet
  /home/travis/build/pandas-dev/pandas/pandas/io/parquet.py:129: ResourceWarning: unclosed file <_io.BufferedReader name='df.parquet.gzip'>
    **kwargs).to_pandas()
```

There's also a `stderr` (or `stdout`) warning from the parser-tests surfacing somewhere:
```
..............................................................x...........................................................s....
........................................Skipping line 3: Expected 3 fields in line 3, saw 4
.......................................s.......................................................................................
```

I've narrowed the ResourceWarning down to the parquet-s3 tests, but couldn't figure out a way to fix it despite *many* tries, so I'm skipping them for now.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23192?src=pr&el=h1) Report
> Merging [#23192](https://codecov.io/gh/pandas-dev/pandas/pull/23192?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/a23f90142352b6427916292b2b9faa7bb61d07bc?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `94.64%`.

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

```diff
@@            Coverage Diff             @@
##           master   #23192      +/-   ##
==========================================
- Coverage   92.25%   92.25%   -0.01%     
==========================================
  Files         161      161              
  Lines       51383    51410      +27     
==========================================
+ Hits        47404    47428      +24     
- Misses       3979     3982       +3
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.64% <94.64%> (-0.01%)` | :arrow_down: |
| #single | `42.3% <10.71%> (-0.02%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23192?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/23192/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.66% <100%> (-0.02%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/23192/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.99% <100%> (-0.04%)` | :arrow_down: |
| [pandas/core/missing.py](https://codecov.io/gh/pandas-dev/pandas/pull/23192/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvbWlzc2luZy5weQ==) | `91.6% <90%> (-0.11%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/23192/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.82% <96.87%> (ø)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23192?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/23192?src=pr&el=footer). Last update [a23f901...411741a](https://codecov.io/gh/pandas-dev/pandas/pull/23192?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

This is still ongoing WIP, but ran into #23823 while trying to use `maybe_upcast_putmask` here, and then #23833 while trying to fix that method... 
conceptually this PR is good, but it does too much in a single go, diluting the intent. several *much* smaller scope PR's would be better.