Save and load binary .npy/.npz archives and load text CSV datasets with loadtxt().
NumPy supports high-speed binary serialization using `.npy` (single array) and compressed `.npz` (multi-array archives), preserving exact shapes and dtypes.
Saving to CSV writes numbers as slow human-readable text characters. Saving to `.npy` dumps raw binary bytes directly from RAM to disk, loading 10x faster.
`.npy` stores data in native binary format with shape/dtype metadata headers. It loads 10x faster and requires 50% less disk space than CSV.
np.save('data.npy', arr); loaded = np.load('data.npy')np.savetxt('data.csv', arr) # Default format is scientific notation e.g. 1.000000000000000000e+01np.savetxt('data.csv', arr, fmt='%d', delimiter=',')Specify `fmt='%d'` for integers and `delimiter=','` for clean CSV output.
Solve the objective below using NumPy vectorized syntax
Create `arr = np.array([100, 200, 300])`, save it to `'test.npy'` with `np.save`, load it with `np.load`, and print.
[100 200 300]