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
Post a Comment