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
To most Python/Pandas users, np.std and lambda x: np.std(x) should be interchangeable, as should any other method and its lambda equivalent. However, due to the implicit translation to pd.std that occurs in the latter example, these two calls use different default values of the ddof parameter, which can lead to real mismatches when refactoring code.
Given the discussion on closed Issue #13344, I gather that this is intended behavior, but it is nevertheless confusing. We may want to consider allowing for comparable output, at least as a default; if users want to override that behavior, they can explicitly provide a value for ddof.
Expected Output
BOTH aggregates output the ddof = 1 calculation:
std2
a
1 1.290994
when no parameters are passed to the lambda.
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.8.1.final.0
python-bits : 64
OS : Darwin
OS-release : 19.2.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
Code Sample, a copy-pastable example if possible
Problem description
To most Python/Pandas users,
np.std
andlambda x: np.std(x)
should be interchangeable, as should any other method and its lambda equivalent. However, due to the implicit translation topd.std
that occurs in the latter example, these two calls use different default values of theddof
parameter, which can lead to real mismatches when refactoring code.Given the discussion on closed Issue #13344, I gather that this is intended behavior, but it is nevertheless confusing. We may want to consider allowing for comparable output, at least as a default; if users want to override that behavior, they can explicitly provide a value for
ddof
.Expected Output
BOTH aggregates output the
ddof = 1
calculation:when no parameters are passed to the lambda.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.8.1.final.0
python-bits : 64
OS : Darwin
OS-release : 19.2.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.1
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.1.0.post20200119
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.1
IPython : 7.12.0
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 : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: