Skip to content

API: Treat 1D vectors as columns in some cases for arith/cmp ops #23306

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

Closed
wants to merge 3 commits into from

Conversation

jbrockmendel
Copy link
Member

Definitely needs discussion.

There are a bunch of GH issues (will track down the list in a bit) that boil down to users expecting DataFrame+(Series|ndarray|listlike) ops to operate column-by-column. This PR implements that behavior for a subset of cases. In particular:

  • other is a Series: indexes match exactly (and columns do not)
  • other is a list/tuple/np.ndarray: length matches df.index (and not df.columns)

This means that things like df == df['A'] will now work.

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@pep8speaks
Copy link

pep8speaks commented Oct 23, 2018

Hello @jbrockmendel! Thanks for updating the PR.

Comment last updated on October 24, 2018 at 02:56 Hours UTC

@jreback
Copy link
Contributor

jreback commented Oct 23, 2018

this is really confusing

we have .eq for this exact reason

pls justify why this should change

@jbrockmendel
Copy link
Member Author

pls justify why this should change

I'm not 100% sure that it should. But it is only now feasible following #23132 and it does come up often enough to merit discussion. I'll try to fill out the list of Issues over the next couple days.

@jorisvandenbossche
Copy link
Member

Can you first open an issue for this to propose a specific behaviour and discuss it?

@jbrockmendel jbrockmendel deleted the collike2 branch October 24, 2018 20:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants