Unit 29Saving and Reading Arrays

You will probably be using numpy not on its own, but as a powerful back end to pandas (Chapter 6, Working with Data Series and Frames), networkx (Chapter 7, Working with Network Data), and machine learning tools (Chapter 10, Machine Learning). You will create numpy arrays from the data provided by low-level, data-processing tools, and deliver them to the higher-level analysis tools. It is unlikely you’ll need to save or read numpy arrays directly.

However, just in case, numpy has a built-in facility for saving arrays to npy files (function save(file, arr)) and reading previously saved arrays from npy files (function load(file)). The files are in a binary format, and only numpy can handle them.

Both functions, ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.