Skip to content

Difference with numpy indexing #652

Open

Description

@huard

Slicing a Numpy multidimensional array and the same h5py dataset yields different results.

>>> import numpy as np
>>> import h5py as h5

>>> dims = [1,2,3,4]
>>> a = np.arange(np.prod(dims)).reshape(dims)
>>> F = h5.File('test.h5')
>>> F.create_dataset('test', data=a)
>>> a[0,slice(None), [0,1]]
array([[[ 0,  1,  2,  3],
        [12, 13, 14, 15]],

       [[ 4,  5,  6,  7],
        [16, 17, 18, 19]]])
>>> F['test'][0,slice(None),[0,1]]
array([[[ 0,  1,  2,  3],
        [ 4,  5,  6,  7]],

       [[12, 13, 14, 15],
        [16, 17, 18, 19]]])

Activity

  1. modified the milestones: 2.7, 2.8 on Dec 21, 2016
  2. modified the milestones: 2.8, on Feb 11, 2018
  3. modified the milestones: 2.9, 2.10 on Oct 14, 2018
  4. removed this from the 2.10 milestone on Jun 3, 2019
  5. takluyver commented on Jun 3, 2019

    @takluyver
    Member

    Dropping the milestone because the corresponding PR wasn't moving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions