Input and output#

NumPy binary files (NPY, NPZ)#

load(file[, mmap_mode, allow_pickle])

Loads arrays or pickled objects from .npy, .npz or pickled file.

save(file, arr[, allow_pickle])

Saves an array to a binary file in .npy format.

savez(file, *args, **kwds)

Saves one or more arrays into a file in uncompressed .npz format.

savez_compressed(file, *args, **kwds)

Saves one or more arrays into a file in compressed .npz format.

Text files#

loadtxt(*args, **kwargs)

Load data from a text file.

savetxt(fname, X, *args, **kwargs)

Save an array to a text file.

genfromtxt(*args, **kwargs)

Load data from text file, with missing values handled as specified.

fromstring(*args, **kwargs)

A new 1-D array initialized from text data in a string.

String formatting#

array2string(a, *args, **kwargs)

Return a string representation of an array.

array_repr(arr[, max_line_width, precision, ...])

Returns the string representation of an array.

array_str(arr[, max_line_width, precision, ...])

Returns the string representation of the content of an array.

format_float_positional(x, *args, **kwargs)

Format a floating-point scalar as a decimal string in positional notation.

format_float_scientific(x, *args, **kwargs)

Format a floating-point scalar as a decimal string in scientific notation.

Base-n representations#

binary_repr(num[, width])

Return the binary representation of the input number as a string.

base_repr(number[, base, padding])

Return a string representation of a number in the given base system.