Skip to content

Commit f8b3b41

Browse files
committed
2 parents 326b869 + 79a49ea commit f8b3b41

File tree

5 files changed

+7
-2
lines changed

5 files changed

+7
-2
lines changed

numpy/input-output/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
## Input and output
2+
3+
File [xy-coordinates.dat](xy-coordinates.dat) contains a list of (x,y) value
4+
pairs. Read the data with `numpy.loadtxt()`. Add then 2.5 to all y values and
5+
write the new data into a file using `numpy.savetxt()`.

numpy/input-output/solution/input-output.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
filename = sys.argv[1]
55
xy = np.loadtxt(filename)
66
xy[:,1] += 2.5
7-
np.savetxt('new_' + filename, xy, fmt='%.6f', header='modified data')
7+
np.savetxt('new-' + filename, xy, fmt='%.6f', header='modified data')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../xy-coordinates.dat

numpy/input-output/solution/xy_coordinates.dat

-1
This file was deleted.

0 commit comments

Comments
 (0)