Closed
Description
Location of the documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.apply.html
Documentation problem
In commit f625730 the documentation of df.apply
was changed, and a note regarding df.apply
behavior to call the applied function twice on the first column/row.
As far as i can tell from this issue and from my own testing (See below) this behavior still exists.
In [1]: import pandas as pd
In [2]: df = pd.DataFrame({'a': [1,2,3]})
In [3]: def mul2(x):
...: print('Hello')
...: return x*2
...:
In [4]: df.apply(mul2)
Hello
Hello
Out[4]:
a
0 2
1 4
2 6
In [5]: pd.show_versions()
INSTALLED VERSIONS
------------------
commit : None
python : 3.7.5.final.0
python-bits : 64
OS : Darwin
OS-release : 19.3.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.3
numpy : 1.18.2
pytz : 2019.3
dateutil : 2.8.1
pip : 19.3.1
setuptools : 41.2.0
Cython : None
pytest : 5.3.2
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 1.0.1
pymysql : None
psycopg2 : 2.8.4 (dt dec pq3 ext lo64)
jinja2 : 2.11.1
IPython : 7.13.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : 0.3.3
gcsfs : None
lxml.etree : None
matplotlib : 3.2.1
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : 0.13.1
pyarrow : None
pytables : None
pytest : 5.3.2
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.12
tables : None
tabulate : None
xarray : 0.15.1
xlrd : None
xlwt : None
xlsxwriter : None
numba : 0.47.0
Suggested fix for documentation
Revert commit f625730 in order to reflect the actual behavior of the apply function