blaze / blaze/datashape

Represent byte order

Open
#227 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
189
Forks
62
PR merge metrics
No merged PRs in 30d

Description

I work with data that is sometimes in non-native byte order. It looks like byte order can not yet be represented in a DataShape. I can get around this by using side channels like the keyword arguments in odo functions, but it would be more convenient to have byte order information as part of the shape.

### Current Behavior

``` python
>>> ds.discover(np.array([1], dtype='u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='=u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='>> ds.discover(np.array([1], dtype='>u4'))
dshape("1 * uint32")
```

### Desired Behavior

One way to do this would be to mirror Numpy and default to the system byte order. This is being run on a little-endian system.

``` python
>>> ds.discover(np.array([1], dtype='u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='=u4'))
dshape("1 * uint32")
>>> ds.discover(np.array([1], dtype='>> ds.discover(np.array([1], dtype='>u4'))
dshape("1 * >uint32")
```

Numpy's behavior for reference:

``` python
>>> np.dtype('u4')
dtype('uint32')
>>> np.dtype('=u4')
dtype('uint32')
>>> np.dtype('>> np.dtype('>u4')
dtype('>u4')
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.