8000 Can't do a formatted print of a <class 'numpy.core.memmap.memmap'> returned by a.mean(a) · Issue #8108 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content
Can't do a formatted print of a <class 'numpy.core.memmap.memmap'> returned by a.mean(a) #8108
Closed
@Christopher-Field

Description

@Christopher-Field

The second line of the program fragment below succeeds if b is a regular numpy array
but generates a TypeError if b is a memory mapped array (memmap).

m2 = b.mean()
print("The mean of b is {:f}.".format(m2))

TypeError: non-empty format string passed to object.format

The work around is a specific type change as
print("The mean of b is {:f}.".format(float(m2)))

A program demonstrating the success and failure is attached. I have observed the error in python 2.7 with numpy 1.10.4, python 3.5 with numpy 1.10.4, and pythion 3.5 with numpy 1.11.1.
I am running OS X 10.10.5.

memmap_error.py.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0