-
[x] I have checked that this issue has not already been reported.
-
[x] I have confirmed this bug exists on the latest version of pandas.
-
[x] (optional) I have confirmed this bug exists on the master branch of pandas.
This came out of https://github.com/pandas-dev/pandas/pull/43213#discussion_r699410411
Code Sample, a copy-pastable example
In [1]: import pandas as pd
In [2]: pd.__version__
Out[2]: '1.4.0.dev0+532.g9bf09adcda'
In [3]: df=pd.DataFrame([[1,2]]*3, columns=["a","b"], dtype="Int64")
In [4]: df.groupby("a").std().dtypes
Out[4]:
b float64
dtype: object
In [5]: df=pd.DataFrame([[1,2]]*3, columns=["a","b"], dtype="Float64")
In [6]: df.groupby("a").std().dtypes
Out[6]:
b float64
dtype: object
Problem description
With Float64
as input, should return Float64
and not float64
Output of pd.show_versions()
Comment From: phofl
See #37494
Comment From: debnathshoham
I don't think this behaviour is specific to nullable dtypes. I think it is always cast to float64
```python In [17]: df=pd.DataFrame([[1,2]]*3, columns=["a","b"], dtype="float32")
In [18]: df.groupby("a").std().dtypes Out[18]: b float64 dtype: object
Comment From: phofl
Does this happen also with other functions except var? I think this is on purpose for std and var
Comment From: debnathshoham
var is working as expected..
```python
In [4]: df=pd.DataFrame([[1,2]]*3, columns=["a","b"], dtype="Int64")
In [5]: df.groupby("a").var().dtypes Out[5]: b Float64 dtype: object
In [6]: df=pd.DataFrame([[1,2]]*3, columns=["a","b"], dtype="float32")
In [7]: df.groupby("a").var().dtypes Out[7]: b float32 dtype: object