ENH: Let initialisation from dicts use insertion order for python >= 3.6 (part III)
State: closed

- [x] closes #19018
- [x] xref #19830 and #19859
- [x] tests added / passed
- [x] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`

This PR lets pandas allow initialisation using insertion order for python>=3.6. E.g. ``Series({'B': 1, 'A': 2})`` will retain order and not convert to ``Series({'A': 2, 'B': 1})``. As such this changes the API soemwhat fundamentally (but in a very good way, IMO).

Some questions:
* Should this change be at the top of the whatsnew, in order to increase visibility to this change?
* Should an option be added to ``pd.options``, so user can revert back to the old behaviour? I'm thinking here of users who have made tests based on dict sort-by-values, and whose tests will break by this new change
* Should there be a deprecation procedure, as asked by @gfyoung ?

I also need to look thorugh the documentation if changes should be made there, but would appreciate getting the basic PR approved first.

Labels:
name: Reshaping
description: Concat, Merge/Join, Stack/Unstack, Explode
name: Compat
description: pandas objects compatability with Numpy or Python functions

Comments:
Comments addressed.
I've uploaded changes, incl. documentation changes.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/19884?src=pr&el=h1) Report
> Merging [#19884](https://codecov.io/gh/pandas-dev/pandas/pull/19884?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/d615f86acc441e206b507b5d71033808a981b398?src=pr&el=desc) will **decrease** coverage by `0.01%`.
> The diff coverage is `91.66%`.

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

```diff
@@            Coverage Diff             @@
##           master   #19884      +/-   ##
==========================================
- Coverage   91.69%   91.67%   -0.02%     
==========================================
  Files         150      150              
  Lines       49043    49045       +2     
==========================================
- Hits        44968    44963       -5     
- Misses       4075     4082       +7
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.05% <91.66%> (-0.02%)` | :arrow_down: |
| #single | `41.79% <91.66%> (-0.04%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/19884?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/sparse/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/19884/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL3Nlcmllcy5weQ==) | `95.2% <ø> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/19884/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.18% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/series.py](https://codecov.io/gh/pandas-dev/pandas/pull/19884/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc2VyaWVzLnB5) | `93.85% <100%> (-0.39%)` | :arrow_down: |
| [pandas/core/sparse/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/19884/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvc3BhcnNlL2ZyYW1lLnB5) | `94.82% <100%> (+0.01%)` | :arrow_up: |
| [pandas/core/panel.py](https://codecov.io/gh/pandas-dev/pandas/pull/19884/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcGFuZWwucHk=) | `97.29% <100%> (-0.01%)` | :arrow_down: |
| [pandas/core/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/19884/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tbW9uLnB5) | `92.04% <83.33%> (-0.92%)` | :arrow_down: |

------

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

Hello @topper-123! Thanks for updating the PR.



























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

##### Comment last updated on March 02, 2018 at 11:18 Hours UTC
The errors in travis-ci were

1:
One which passed locally, so sure how to handle that. It complains about resources also, so maybe the failures are related to that?

2:
One with the exit quote:
> The job exceeded the maximum time limit for jobs, and has been terminated.

so unrelated to my PR.

Maybe the tests should be run once again?
Green.
Comments from @jorisvandenbossche addressed.
@topper-123 For future reference, could you add commits instead of amending it to the previous or squashing? That makes it easier to see what you updated.
thanks @topper-123