Skip to content

Numpy

Creating Arrays

![[Screen Shot 2024-01-21 at 19.44.51.png]]

I/O

![[Screen Shot 2024-01-21 at 19.45.08.png]] dataset = np.loadtxt(self.infile, dtype=int, delimiter='\t', skiprows=1) np.savetxt(self.outfile, predict_label, fmt='%i', delimiter='\n')

f = open(metrics, "w")
f.write(f"error(train): {train_error}")
f.write("\n")
f.write(f"error(test): {test_error}")

Data Types

![[Screen Shot 2024-01-21 at 19.45.18.png]]

Inspecting Arrays

![[Screen Shot 2024-01-21 at 19.45.35.png]]

Maths

![[Screen Shot 2024-01-21 at 19.45.51.png]]

Copying Arrays

![[Screen Shot 2024-01-21 at 19.46.20.png]]

Sorting Arrays

![[Screen Shot 2024-01-21 at 19.46.29.png]]

Subsetting, slicing, indexing

![[Screen Shot 2024-01-21 at 19.46.52.png]]

Array Manipulation

![[Screen Shot 2024-01-21 at 19.47.06.png]]