Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@mrocklin
Copy link
Member

@mrocklin mrocklin commented Nov 8, 2016

Fixes #635

cc @shoyer

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

should test m8 as well (timedelta)

@mrocklin
Copy link
Member Author

mrocklin commented Nov 8, 2016

Added m8 tests. Thanks @jreback . Any other suggestions?

'strides': x.strides,
'shape': x.shape}

data = x.view('u1').data
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little nervous about using view with a different dtype itemsize. See this warning from the docs:

For a.view(some_dtype), if some_dtype has a different number of bytes per entry than the previous dtype (for example, converting a regular array to a structured array), then the behavior of the view cannot be predicted just from the superficial appearance of a (shown by print(a)). It also depends on exactly how a is stored in memory. Therefore if a is C-ordered versus fortran-ordered, versus defined as a slice or transpose, etc., the view may give different results.

It might be just fine for merely getting access to the data buffer, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think that these would all be tricky situations if the itemsizes were relatively prime or if you actually cared about indexing afterwards. I think we're safe turning it into a view of singleton bytes though.

@jreback
Copy link
Contributor

jreback commented Nov 8, 2016

numpy scalars

e.g. np.array(5)

@jreback
Copy link
Contributor

jreback commented Nov 8, 2016

maybe big/little endian

e.g. >i8 and <i8

@mrocklin mrocklin merged commit f110ee3 into dask:master Nov 8, 2016
@mrocklin mrocklin deleted the numpy-dtypes branch November 8, 2016 18:31
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