CLN: Index.append() refactoring
State: closed

 - [x] tests passed (one xpassed due to #16234)
 - [x] passes ``git diff upstream/master --name-only -- '*.py' | flake8 --diff``

The first commit is just #16213 .

The others reorganize a bit the code for ``Index.append()``.

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

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=h1) Report
> Merging [#16236](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/2002da33b0a755fcf7ef64b2c87ca4252f0e7df0?src=pr&el=desc) will **decrease** coverage by `0.03%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #16236      +/-   ##
==========================================
- Coverage   90.24%   90.21%   -0.04%     
==========================================
  Files         164      164              
  Lines       50894    50920      +26     
==========================================
+ Hits        45930    45938       +8     
- Misses       4964     4982      +18
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88% <100%> (-0.02%)` | :arrow_down: |
| #single | `40.3% <65%> (-0.1%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `98.48% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `95.69% <100%> (-0.06%)` | :arrow_down: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `92.69% <100%> (+0.57%)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `94.88% <0%> (-1.78%)` | :arrow_down: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `91.82% <0%> (-0.77%)` | :arrow_down: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `90.68% <0%> (-0.35%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.58% <0%> (-0.1%)` | :arrow_down: |
| [pandas/\_version.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL192ZXJzaW9uLnB5) | `44.65% <0%> (+1.9%)` | :arrow_up: |

------

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

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=h1) Report
> Merging [#16236](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d0d28fec180ee61de17921fe5068ecde95adae8a?src=pr&el=desc) will **decrease** coverage by `0.02%`.
> The diff coverage is `100%`.

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

```diff
@@            Coverage Diff             @@
##           master   #16236      +/-   ##
==========================================
- Coverage   91.01%   90.98%   -0.03%     
==========================================
  Files         162      162              
  Lines       49567    49565       -2     
==========================================
- Hits        45111    45099      -12     
- Misses       4456     4466      +10
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `88.77% <100%> (-0.01%)` | :arrow_down: |
| #single | `40.25% <68.57%> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `95.87% <100%> (-0.06%)` | :arrow_down: |
| [pandas/core/dtypes/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbmNhdC5weQ==) | `98.28% <100%> (+0.2%)` | :arrow_up: |
| [pandas/core/indexes/range.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9yYW5nZS5weQ==) | `92.18% <100%> (-0.63%)` | :arrow_down: |
| [pandas/core/indexes/category.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9jYXRlZ29yeS5weQ==) | `98.53% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `96.66% <100%> (ø)` | :arrow_up: |
| [pandas/core/indexes/interval.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9pbnRlcnZhbC5weQ==) | `92.61% <100%> (ø)` | :arrow_up: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/16236?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.72% <0%> (-0.1%)` | :arrow_down: |

------

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

can you rebase and update?
got lost sorry.. pls rebase / update.
> My goal is to centralize all of this code, and NOT decentralize it to the Index whenever possible.

My fear is that it is difficult to move to ``dtypes.concat`` code which makes a clever use of overrides - and on the other hand, we loose all benefits of inheritance if we don't make a clever use of overrides (we already have too much code with sequences of ``if is_some_dtype(idx): _call_specialized_method_for_such_dtype``, which harm readability).

Anyway, I will rebase and try to move and replace with wrappers as much logic as I can.
Hello @toobaz! Thanks for updating the PR.













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

##### Comment last updated on August 21, 2017 at 15:24 Hours UTC
OK, this new version is much simpler, and still removes all code duplication from #16213 .
@jreback ping
lgtm. just if you can explain that where I indicated a bit more.