Skip to content

module numpy.npio

Source: stdlib/numpy/npio.codon


memmap(filename, dtype: type = u8, mode: str = "r+", offset: int = 0, shape = None, order: str = "C")


parse_header(header: str)


load(file, mmap_mode: Optional[str] = None, ndim: Literal[int] = 1, dtype: type = float)


save(file, arr)



fromfile(file, dtype: type = float, count: int = -1, sep: str = "", offset: int = 0)


fromstring(string: str, dtype: type = float, count: int = -1, sep: str = "")


ndarray[dtype,ndim] @extend Class is extended to add given methods

Methods

tofile(self, file, sep: str = "")


Converters[dtype,F,M,U] @tuple Class is named tuple (cannot write fields)

Fields

funcs: F

mask: M

usecols: U

dtype: type

F: type

M: type

U: type

Magic methods

__new__(funcs, mask, usecols, dtype: type)

__call__(self, field: str, idx: int)


normalize_col(col: int, num_fields: int)


default_fill(dtype: type)


malformed(row: int, num_fields: int)


min_dim(arr: ndarray, ndmin: Literal[int])


make_conv(converters, num_fields: int, usecols, dtype: type)


CSVReader

Magic methods

__init__(self, path: str, delimiter: str = ",", quotechar: str = """, comments: str = "")

__enter__(self)

__exit__(self)

Methods

is_delimiter(self, c: byte)

is_comment(self, c: byte)

skip_delimiter(self, i: int)

skip_comments(self, i: int)

skip_lines(self, i: int, skip: int)

get_num_fields(self, i0: int)

parse(self, row_callback, num_fields: int, maxrows: int, i0: int)


ArrayUpdate[A,C,F]

Fields

arr: A

cols: C

conv: F

last_row: int

A: type

C: type

F: type

Properties

cap @property Method is a class property

Magic methods

__init__(self, arr: A, cols: C, conv: F)

__call__(self, fields: Ptr[str], num_fields: int, row: int)

Methods

resize_arrays(self, new_cap: int)

trim_arrays(self)

convert(self, field: str, idx: int, dtype: type)

convert_static(self, field: str, idx: Literal[int], dtype: type)


loadtxt(fname: str, dtype: type = float, comments: Optional[str] = "#", delimiter: Optional[str] = None, converters = None, skiprows: int = 0, usecols = None, unpack: Literal[bool] = False, ndmin: Literal[int] = 0, max_rows: Optional[int] = None, quotechar: Optional[str] = None)


CSVReaderGen

Magic methods

__init__(self, path: str, delimiter: str = ",", comments: str = "")

__enter__(self)

__exit__(self)

Methods

fix_names(self, excludelist: List[str], deletechars: str, replace_space: str, upper: bool, lower: bool)

is_delimiter(self, c: byte)

is_comment(self, c: byte)

skip_lines(self, i: int, skip: int)

skip_delimiter(self, i: int)

skip_delimiter(self, i: int, line: str)

skip_comments(self, i: int)

get_num_fields(self, i: int, get_names: bool)

partition_line(self, line: str, delimiter, num_fields: int, row: int, invalid_raise: bool)

get_num_fields_spaced(self, i: int, get_names: bool, delimiter)

get_num_fields_single(self, line: str, get_names: bool)

get_num_fields_single_spaced(self, line: str, get_names: bool, delimiter)

translate_cols(self, usecols, num_fields: int)

parse(self, i: int, row_callback, num_fields: int, maxrows: int, invalid_raise: bool)

parse_spaced(self, i: int, row_callback, num_fields: int, maxrows: int, invalid_raise: bool, delimiter)

parse_single(self, line: str, row_callback, row: int, fields: Ptr[str], num_fields: int, invalid_raise: bool)

parse_single_spaced(self, line: str, row_callback, row: int, fields: Ptr[str], num_fields: int, invalid_raise: bool, delimiter)


ArrayUpdateGen[A,C,F,M]

Fields

arr: A

cols: C

conv: F

filling_values: M

autostrip: bool

loose: bool

last_row: int

A: type

C: type

F: type

M: type

Properties

cap @property Method is a class property

Magic methods

__init__(self, arr: A, cols: C, conv: F, filling_values: M, autostrip: bool, loose: bool)

__call__(self, fields: Ptr[str], num_fields: int, row: int)

Methods

resize_arrays(self, new_cap: int)

trim_arrays(self)

fill_value(self, idx: int, dtype: type)

fill_value_static(self, idx: Literal[int], dtype: type)

convert(self, field: str, idx: int, dtype: type)

convert_static(self, field: str, idx: Literal[int], dtype: type)



ndarray[dtype,ndim] @extend Class is extended to add given methods

Magic methods

__pickle__(self, jar: Jar)

__unpickle__(jar: Jar)