Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
BUG: Use np.integer instead of int, to allow unsigned integers
Additionally, make the fixes needed to avoid an incoming deprecation in numpy/numpy#9505
  • Loading branch information
eric-wieser committed Aug 6, 2017
commit 7b8883cacb2a29c33ef2edaf02b3a55dbc772998
6 changes: 3 additions & 3 deletions lib/matplotlib/mlab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3136,17 +3136,17 @@ def get_type(item, atype=int):
def get_justify(colname, column, precision):
ntype = column.dtype

if np.issubdtype(ntype, str) or np.issubdtype(ntype, bytes):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This didn't catch unicode on python 2, but did on python 3

if np.issubdtype(ntype, np.character):
fixed_width = int(ntype.str[2:])
length = max(len(colname), fixed_width)
return 0, length+padding, "%s" # left justify

if np.issubdtype(ntype, int):
if np.issubdtype(ntype, np.integer):
length = max(len(colname),
np.max(list(map(len, list(map(str, column))))))
return 1, length+padding, "%d" # right justify

if np.issubdtype(ntype, float):
if np.issubdtype(ntype, np.floating):
fmt = "%." + str(precision) + "f"
length = max(
len(colname),
Expand Down