TypeError: copy() takes no keyword arguments · Issue #31441 · pandas-dev/pandas (original) (raw)
Code Sample, a copy-pastable example if possible
import pandas as pd
df = pd.DataFrame(['A', 'A', 'B', 'B'], columns=['grps']) df.groupby('grps').apply(lambda x: x.index.to_list())
Traceback (most recent call last): File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 735, in apply result = self._python_apply_general(f) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 751, in _python_apply_general keys, values, mutated = self.grouper.apply(f, self._selected_obj, self.axis) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/ops.py", line 171, in apply result_values, mutated = splitter.fast_apply(f, group_keys) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/ops.py", line 925, in fast_apply return libreduction.apply_frame_axis0(sdata, f, names, starts, ends) File "pandas/_libs/reduction.pyx", line 505, in pandas._libs.reduction.apply_frame_axis0 TypeError: copy() takes no keyword arguments During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3319, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 4, in df.groupby('grps').apply(lambda x: x.index.to_list()) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 746, in apply return self._python_apply_general(f) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 751, in _python_apply_general keys, values, mutated = self.grouper.apply(f, self._selected_obj, self.axis) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/ops.py", line 171, in apply result_values, mutated = splitter.fast_apply(f, group_keys) File "/home/bay2rng/miniconda3/envs/p356_rtp_production_scheduling/lib/python3.7/site-packages/pandas/core/groupby/ops.py", line 925, in fast_apply return libreduction.apply_frame_axis0(sdata, f, names, starts, ends) File "pandas/_libs/reduction.pyx", line 505, in pandas._libs.reduction.apply_frame_axis0 TypeError: copy() takes no keyword arguments
Problem description
This snippet is working well on version 0.25.3. It breaks in version 1.0.0.
Expected Output
A [0, 1] B [2, 3] dtype: object
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-72-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.0.0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 45.1.0.post20200127
Cython : None
pytest : 5.3.2
hypothesis : None
sphinx : 2.3.1
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.11.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 0.15.1
pytables : None
pytest : 5.3.2
pyxlsb : None
s3fs : None
scipy : 1.4.1
sqlalchemy : 1.3.13
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None