Skip to content

Fix mistake in Pytables querying with numpy scalar value. Fixes #11283 #11291

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

Merged
merged 1 commit into from
Oct 13, 2015

Conversation

BrenBarn
Copy link

Fixes #11283

First PR to this project. The fix is minuscule, but let me know if I did anything awry.

@shoyer
Copy link
Member

shoyer commented Oct 12, 2015

Could you please add a note to the bug fixes section of the release notes?
https://github.com/pydata/pandas/blob/master/doc/source/whatsnew/v0.17.1.txt

Also, be sure to include Fixes #XXXX in the body of your comment in pull requests -- that links the issues and will automatically close it when the PR is merged (I just edited your message to add that in).

@jreback
Copy link
Contributor

jreback commented Oct 12, 2015

lgtm. pls squash. ping on green.

@jreback jreback added Bug IO HDF5 read_hdf, HDFStore labels Oct 12, 2015
@jreback jreback added this to the 0.17.1 milestone Oct 12, 2015
@@ -129,7 +129,7 @@ def conform(self, rhs):
""" inplace conform rhs """
if not com.is_list_like(rhs):
rhs = [rhs]
if hasattr(self.rhs, 'ravel'):
if hasattr(rhs, 'ravel'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually this might be better to call: np.array(rhs), I don't really remember why I did this in the first place. Maybe you can divine some things from the test cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not idiomatic to check for an array
just because it works doesn't mean it's correct

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So are you saying it should be if isinstance(rhs, np.ndarray)? That seems to work okay.

@BrenBarn
Copy link
Author

@jreback Are you saying to do rhs = np.array(rhs) instead of rhs = [rhs]? As far as I can tell that line is only to make the iteration work right in the line right after the call to conform (here). I don't think it needs to be a numpy array and I'm a bit reluctant to make that change without knowing why. It doesn't appear to be causing any problems.

The fix is working fine now.

jreback added a commit that referenced this pull request Oct 13, 2015
Fix mistake in Pytables querying with numpy scalar value.  Fixes #11283
@jreback jreback merged commit 4a182d3 into pandas-dev:master Oct 13, 2015
@jreback
Copy link
Contributor

jreback commented Oct 13, 2015

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO HDF5 read_hdf, HDFStore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mistake in BinOp.conform?
3 participants