Skip to content

ARROW-1216: [Python] Fix creating numpy array from arrow buffers on python 2#844

Closed
pcmoritz wants to merge 2 commits intoapache:masterfrom
pcmoritz:numpy-buffer
Closed

ARROW-1216: [Python] Fix creating numpy array from arrow buffers on python 2#844
pcmoritz wants to merge 2 commits intoapache:masterfrom
pcmoritz:numpy-buffer

Conversation

@pcmoritz
Copy link
Contributor

No description provided.

Copy link
Member

@xhochy xhochy left a comment

Choose a reason for hiding this comment

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

+1, LGTM. I'll merge on green build.

Thanks for fixing this so quickly!

@pcmoritz
Copy link
Contributor Author

No problem! It's a little unfortunate that numpy doesn't support the new buffer protocol (seems like in python 2.7 that would be possible in principle).

byte_array[0] = 42
buf = pa.frombuffer(byte_array)
array = np.frombuffer(buf, dtype="uint8")
assert array[0] == byte_array[0]
Copy link
Member

Choose a reason for hiding this comment

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

Can you verify that this sets the array's base member?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@wesm Thanks for the note, I added the check and the tests have passed.

@pcmoritz pcmoritz changed the title ARROW-1216: Fix creating numpy array from arrow buffers on python 2 ARROW-1216: [Python] Fix creating numpy array from arrow buffers on python 2 Jul 15, 2017
@asfgit asfgit closed this in 9ff39f3 Jul 15, 2017
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.

3 participants

Comments