Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Pandas 1.1.0 apply function with axis=1 seems to mishandle the rows #35634

Closed
arshad171 opened this issue Aug 8, 2020 · 1 comment · Fixed by #35633
Closed

BUG: Pandas 1.1.0 apply function with axis=1 seems to mishandle the rows #35634

arshad171 opened this issue Aug 8, 2020 · 1 comment · Fixed by #35633
Labels
Bug Duplicate Report Duplicate issue or pull request
Milestone

Comments

@arshad171
Copy link

arshad171 commented Aug 8, 2020

The functionality of the apply(func, axis=1) in the newly released pandas==1.1.0 is not working as expected.

Pandas seems to be overwriting all the rows in the data frame with the 1st row present. This is happening specifically when introducing a new column in the data frame when running func method on each of the rows.

This working in pandas==1.0.5, but seems to be a bug in pandas=1.10.

I am attaching a sample script and the logs captured for pandas==1.0.5 and pandas==1.10.

Attachments:

  1. sample script to reproduce the issue (rename to .py before running) --> script.txt

  2. output 1 (pandas==1.0.5) - working as expected --> out_pandas_1.0.5.log

  3. output 2 (pandas==1.1.0) - buggy --> out_pandas_1.1.0.log

As you can see in the out_pandas_1.1.0.log log, after preprocessing the data frame using df = df.apply(process_text, axis=1) all the rows in the data frame have been overwritten with the 1st row.

This was not the case with pandas==1.0.5, check the out_pandas_1.0.5.log log.

Environment

  • OS: Ubuntu 20.04
  • Python: 3.7.7 (anaconda env)
@arshad171 arshad171 added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 8, 2020
@simonjayhawkins
Copy link
Member

Thanks @arshad171 for the report. This appears to be a duplicate of #35462 so closing.

@simonjayhawkins simonjayhawkins added Duplicate Report Duplicate issue or pull request and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Aug 10, 2020
@jreback jreback added this to the 1.1.1 milestone Aug 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants