Hands-on: Input and output

In this exercise we study how to read and write arrays to disk.

Source code for this exercise is located in numpy/input-output/

File numpy/input-output/xy-coordinates.dat contains a list of (x,y) value pairs. Read the data with numpy.loadtxt(). Add then 2.5 to all y values and write the new data into a file using numpy.savetxt().

Share this article:

This article is from the free online course:

Python in High Performance Computing

Partnership for Advanced Computing in Europe (PRACE)