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

Skip to content

Multi-dimensionial array support for savetxt / loadtxt (Trac #1888) #2481

@numpy-gitbot

Description

@numpy-gitbot

Original ticket http://projects.scipy.org/numpy/ticket/1888 on 2011-06-30 by @brickZA, assigned to unknown.

I think it would be feasible to support multi-dimensional saving/loading quite simply by using multiple line-breaks for 'higher-dimensional' linebreaks.

d3D = numpy.array([[[111, 112], [121, 122]], 
                   [[211, 212], [221, 222]]])

could be written to text quite unambigiously as

111 112
121 122
            <--- two line breaks indicate break in the 3rd dimension
211 212
221 222

Similarly, 3 line breaks could indicate a break in the 4th dimension.

Another option would be to have the option to write out text in nested-list format. I.e., simply write

[[[111, 112], [121, 122]], [[211, 212], [221, 222]]]

to the file.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions