python - numpy - pretty printing -


i have numpy array of strings. when value in array undefined, none printed expect. possible provide default value none values?

e.g. in following want "_" instead of none

[[none b c]  [m none o]  [x y none]] 

would become

[[_ b c]  [m _ o]  [x y _]] 

a simple solution might transform array string first , replace string none afterwards, example if matrix a:

print(str(a).replace('none','_')) 

you can define function:

def printarray(a):      print(str(a).replace('none','_')) 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -