Skip to content

Instantly share code, notes, and snippets.

@konverner
Created February 28, 2021 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save konverner/b63802b9a51076f03a7b8f1d02632261 to your computer and use it in GitHub Desktop.
Save konverner/b63802b9a51076f03a7b8f1d02632261 to your computer and use it in GitHub Desktop.
pretty matrix print in Python
def print_matrix(M,precision=3):
M_copy = M.copy()
M_copy = np.round(M_copy,precision)
for row in M_copy:
print(str("{:>10} "*len(M)).format(*row))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment