bundles / numpy latest / numpy / lib / _iotools / StringConverter
class
numpy.lib._iotools:StringConverter
source: build-install/usr/lib/python3.14/site-packages/numpy/lib/_iotools.py:452
Signature
class StringConverter(dtype_or_func = None, default = None, missing_values = None, locked = False)Members
Summary
Factory class for function transforming a string into another object (int, float).
Extended Summary
After initialization, an instance can be called to transform a string into another object. If the string is recognized as representing a missing value, a default value is returned.
Parameters
dtype_or_func: {None, dtype, function}, optionalIf a dtype, specifies the input data type, used to define a basic function and a default value for missing data. For example, when dtype is float, the func attribute is set to float and the default value to
np.nan. If a function, this function is used to convert a string to another object. In this case, it is recommended to give an associated default value as input.default: any, optionalValue to return by default, that is, when the string to be converted is flagged as missing. If not given, StringConverter tries to supply a reasonable default value.
missing_values: {None, sequence of str}, optionalNoneor sequence of strings indicating a missing value. IfNonethen missing values are indicated by empty entries. The default isNone.locked: bool, optionalWhether the StringConverter should be locked to prevent automatic upgrade or not. Default is False.
Attributes
func: functionFunction used for the conversion.
default: anyDefault value to return when the input corresponds to a missing value.
type: typeType of the output.
_status: intInteger representing the order of the conversion.
_mapper: sequence of tuplesSequence of tuples (dtype, function, default value) to evaluate in order.
_locked: boolHolds
lockedparameter.
Aliases
numpy.lib._iotools.StringConverter