Don't Print NumPy Arrays! Use Lovely-NumPy Instead.
We often print raw numpy arrays during debugging. But this approach is not very useful. This is because printing does not convey much information about the data it holds, especially when the array is large.
Instead, use ๐ฅ๐จ๐ฏ๐๐ฅ๐ฒ-๐ง๐ฎ๐ฆ๐ฉ๐ฒ. Rather than viewing raw arrays, it prints a summary of the array. This includes its shape, distribution, mean, standard deviation, etc.
It also shows if the numpy array has NaNs and Inf values, whether it is filled with zeros, and many more.
P.S. If you work with tensors, then you can use ๐ฅ๐จ๐ฏ๐๐ฅ๐ฒ-๐ญ๐๐ง๐ฌ๐จ๐ซ๐ฌ.
Read more: Documentation.
Share this post on LinkedIn: Post Link.
The code snippets for the posts I have shared here are available on GitHub. Check out this repository: GitHub.
I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.