You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importpandasaspdimportnumpyasnpprint( pd.__version__ ) # 1.0.1df=pd.DataFrame( [[1, 0], [2, np.nan], [3, np.nan]], columns=['a', 'b'] )
print( df )
# a b# 0 1 0.0# 1 2 NaN# 2 3 NaNunused=df.groupby('a').agg({'b': 'nunique'}) # this shouldn't change anything in df, right?print( df ) # prints out# a b# 0 1 0.000000e+00# 1 2 -9.223372e+18# 2 3 -9.223372e+18# what happened to my nans?
Problem description
For some reason the agg, groupby operation is changing the orginal nan values in the b column
to a special float value.
In the previous version of pandas I was using, this didn't happen.
Expected Output
The expected output of the print should the same as the one of the first print as groupby + agg should never change the input df (right?)
Output of pd.show_versions()
[paste the output of ``pd.show_versions()`` here below this line]
Code Sample, a copy-pastable example if possible
Problem description
For some reason the agg, groupby operation is changing the orginal nan values in the b column
to a special float value.
In the previous version of pandas I was using, this didn't happen.
Expected Output
The expected output of the print should the same as the one of the first print as groupby + agg should never change the input df (right?)
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.6.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-70-generic
machine : x86_64
processor :
byteorder : little
LC_ALL : None
LANG : sv_SE.UTF-8
LOCALE : sv_SE.UTF-8
pandas : 1.0.1
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.2.0.post20200210
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : 2.8.4 (dt dec pq3 ext lo64)
jinja2 : 2.11.1
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : 1.0.6
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.13
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: