BUG: GroupBy return EA dtype
State: closed

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


Labels:
name: Groupby
name: ExtensionArray
description: Extending pandas with custom dtypes or arrays.

Comments:
Hello @5hirish! Thanks for submitting the PR.

 - There are no PEP8 issues in the file [`pandas/core/groupby/groupby.py`](https://github.com/5hirish/pandas/blob/27ce8281db00069d6cdaa0934a9a966db0cc582b/pandas/core/groupby/groupby.py) !

 - There are no PEP8 issues in the file [`pandas/tests/groupby/test_grouping.py`](https://github.com/5hirish/pandas/blob/27ce8281db00069d6cdaa0934a9a966db0cc582b/pandas/tests/groupby/test_grouping.py) !


Ran tests locally `pytest pandas/tests/groupby/test_grouping.py -v` and `pytest pandas/tests/groupby/ -v`; successfull
@jreback 
1) Tests under `pytest pandas/tests/arrays/` like `test_integer.py/test_preserve_dtypes`, `test_integer.py/test_reduce_to_float` are failing because:
```
AssertionError: Attributes are different
Attribute "dtype" are different
     [left]:  Int64      <-- result
     [right]: float64  <-- expected
```
there is custom datatype `Int64` in the test input data of the above tests and test expects it to be converted to `int64` or `float64`. Does pandas consider `Int64` as `int64`, cause `Int64` satisfies both the following conditions: `if is_extension_array_dtype(dtype):` and `if numeric_only and is_numeric_dtype(dtype) or not numeric_only` ?

2)  Tests under `pandas/tests/sparse/` like `test_groupby.py/test_groupby_includes_fill_value` are failing because:
```
AssertionError: Attributes are different           
Attribute "dtype" are different
    [left]:  Sparse[float64, nan]   <-- result
    [right]: float64                       <-- expected
```
For failures like 1, you'll need to update `expected` to have the new type.

> Does pandas consider Int64 as int64

No. Int64 and int64 are different. Int64 is our integer-NA dtype.

You'll need to update the Sparse tests as well. you'll need to do `to_sparse` on the `expected`.

All tests and checks have passed except for one where I got this error although all tests have passed `The command "ci/code_checks.sh" exited with 1.` please review and let me know.
isort error: https://travis-ci.org/pandas-dev/pandas/jobs/447147983#L2772

Make sure to merge master. LMK if you need help fixing it.
Did ` isort pandas/core/groupby/groupby.py` locally, fixed imports, still error.
@5hirish I think you needed to merge master before running isort. Pretty sure travis tests a merge commit, which may have explained the difference.

I merged master and pushed a change. So you'll want to pull before making additional changes.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/23318?src=pr&el=h1) Report
> Merging [#23318](https://codecov.io/gh/pandas-dev/pandas/pull/23318?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/93aba79e4fa822b4d029bda795c61d62fe5998e3?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/23318/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/23318?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #23318      +/-   ##
==========================================
+ Coverage   92.22%   92.23%   +<.01%     
==========================================
  Files         161      161              
  Lines       51191    51202      +11     
==========================================
+ Hits        47210    47225      +15     
+ Misses       3981     3977       -4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.61% <100%> (ø)` | :arrow_up: |
| #single | `42.26% <14.28%> (ø)` | :arrow_up: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/23318?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/groupby/groupby.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ3JvdXBieS9ncm91cGJ5LnB5) | `96.51% <100%> (+0.02%)` | :arrow_up: |
| [pandas/core/arrays/timedeltas.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL3RpbWVkZWx0YXMucHk=) | `93.75% <0%> (-0.56%)` | :arrow_down: |
| [pandas/util/testing.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL3V0aWwvdGVzdGluZy5weQ==) | `86.64% <0%> (-0.2%)` | :arrow_down: |
| [pandas/core/indexes/base.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9iYXNlLnB5) | `96.46% <0%> (-0.16%)` | :arrow_down: |
| [pandas/core/arrays/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2RhdGV0aW1lbGlrZS5weQ==) | `96.1% <0%> (-0.06%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.41% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/indexes/datetimelike.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZWxpa2UucHk=) | `98.01% <0%> (-0.01%)` | :arrow_down: |
| [pandas/core/indexes/api.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9hcGkucHk=) | `99% <0%> (ø)` | :arrow_up: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.03% <0%> (ø)` | :arrow_up: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `96.81% <0%> (ø)` | :arrow_up: |
| ... and [6 more](https://codecov.io/gh/pandas-dev/pandas/pull/23318/diff?src=pr&el=tree-more) | |

------

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

thanks @5hirish