Created
April 22, 2014 23:10
-
-
Save ccorcos/11197543 to your computer and use it in GitHub Desktop.
Python NumPy: pretty print multidimensional ndarray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pylab import * | |
from pprint import pprint | |
def arrayToList(arr): | |
if type(arr) == type(array([])): | |
return arrayToList(arr.tolist()) | |
elif type(arr) == type([]): | |
return [arrayToList(a) for a in arr] | |
else: | |
return arr | |
def prettyArray(arr): | |
pprint(arrayToList(arr)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment