arrayprint.py 766 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import numpy as np
  2. AR = np.arange(10)
  3. AR.setflags(write=False)
  4. with np.printoptions():
  5. np.set_printoptions(
  6. precision=1,
  7. threshold=2,
  8. edgeitems=3,
  9. linewidth=4,
  10. suppress=False,
  11. nanstr="Bob",
  12. infstr="Bill",
  13. formatter={},
  14. sign="+",
  15. floatmode="unique",
  16. )
  17. np.get_printoptions()
  18. str(AR)
  19. np.array2string(
  20. AR,
  21. max_line_width=5,
  22. precision=2,
  23. suppress_small=True,
  24. separator=";",
  25. prefix="test",
  26. threshold=5,
  27. floatmode="fixed",
  28. suffix="?",
  29. legacy="1.13",
  30. )
  31. np.format_float_scientific(1, precision=5)
  32. np.format_float_positional(1, trim="k")
  33. np.array_repr(AR)
  34. np.array_str(AR)