Skip to content

is_string_like returns True for numpy object arrays #7725

Closed
@fdtomasi

Description

@fdtomasi

Bug report

Bug summary

Function is_string_like returns True for numpy object arrays

Code for reproduction

import numpy as np
from matplotlib.cbook import is_string_like
print(is_string_like(np.array(map(str, [1,2,3]), dtype=object)))

Actual outcome

True

Expected outcome

False

The problem is that the line 707 obj + '' in is_string_like does not generate an exception with such numpy array.

Matplotlib version

  • Matplotlib version: 1.5.3
  • OS: Ubuntu 14.04
  • Python and Matplotlib Installed with Anaconda

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions