use fused types for reshape
State: closed

- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes `git diff upstream/master -u -- "*.py" | flake8 --diff`
- [ ] whatsnew entry


Labels:
name: Refactor
description: Internal refactoring of code
name: Internals
description: Related to non-user accessible pandas implementation

Comments:
I know very little of Cython (or fused), but looked up in the docs, and [saw this warning](http://docs.cython.org/en/latest/src/userguide/fusedtypes.html)

    
```
Note

Support is still somewhat experimental, there may be bugs! 
```

Are we sure this is mature enough?
> Are we sure this is mature enough?

This is a reasonable concern.  The docs don't say what version that warning was added in, but later on that page it suggests that the feature was available in 0.20.0 (... I think) in which case its been around for awhile.

In porting the tempita functions one-by-one I am finding a few places where there might be bugs, but I'm not at all ready to rule out the possibility that the problems are on my end.

Even if we don't go in this direction, hopefully we can produce some good bug reports for cython.  In my experience they've been very responsive/helpful.
Yeah, but my concern is if bugs in pandas' behaviour originates from Cython, then we might get situations where:
* pandas 0.24 requires cython 0.28.2+
* pandas 0.24.1 requires cython 0.28.6+ (because of a bug in cython 0.28.5)
* pandas 0.24.2 requires cython 0.29 (a bug in Cython 0.28.6...)
* etc.

which would be annoying and maybe a bit unstable. This could also happen from other bugs in cython, but the risk is probably greater for the fused API because it is declared not bug-free by the cython team...

I don't have the ability to make a recommendation on this, but take it as a thing to consider and check for. Maybe consult with the Cython team whether fused types can be considered stable now?

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/22454?src=pr&el=h1) Report
> :exclamation: No coverage uploaded for pull request base (`master@55d176d`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).
> The diff coverage is `n/a`.

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

```diff
@@            Coverage Diff            @@
##             master   #22454   +/-   ##
=========================================
  Coverage          ?   92.04%           
=========================================
  Files             ?      169           
  Lines             ?    50773           
  Branches          ?        0           
=========================================
  Hits              ?    46734           
  Misses            ?     4039           
  Partials          ?        0
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.45% <ø> (?)` | |
| #single | `42.23% <ø> (?)` | |


------

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

> Maybe consult with the Cython team whether fused types can be considered stable now?

@scoder : 

Hi, I noticed that you are one of the main commiters to the [Cython](https://github.com/cython/cython) repository, and we had a question regarding fused types.  We here at `pandas` were planning on using them in place of `tempita` for some of our source code as you can see in this PR.  However, there's a note in the [docs](http://docs.cython.org/en/latest/src/userguide/fusedtypes.html) from >5 years ago (at least according to the commit history) regarding the instability of fused types.  Is this still the case?

Happy to formally open an issue if that is preferred (this is more of a usage question, hence the "cold" mention for lack of a better term).  Thanks!
Thanks for asking, I removed that note from the docs.
@scoder : Thanks for the timely reply!  Greatly appreciated.

@topper-123 : Does that [response](https://github.com/pandas-dev/pandas/pull/22454#issuecomment-415954422) alleviate your concerns?
👍
@jreback gentle ping
ok this is fine (rebase the other fused impls after this merge).