diff options
author | Ross Barnowski <rossbar@berkeley.edu> | 2022-09-28 12:13:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-28 21:13:45 +0200 |
commit | 1dc42043673584c9cf05dec46c540b1547a2ccbf (patch) | |
tree | 6d5adb69f0ab380e1988e7492421931c9a12c7c0 /numpy/lib/npyio.py | |
parent | 924a57d18bb98ec7cb3ceb35995b65f0d1cc4903 (diff) | |
download | numpy-1dc42043673584c9cf05dec46c540b1547a2ccbf.tar.gz |
DOC: Improve `converters` parameter description for loadtxt (#22254)
* DOC: Make converters param description more concise.
A wording proposal to hopefully make the description of the
converters parameter of loadtxt more clear, and direct readers
to the example section.
* DOC: Combine both suggestions for param descr.
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 237d7e4ef..89b01c845 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1088,12 +1088,10 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, The string used to separate values. For backwards compatibility, byte strings will be decoded as 'latin1'. The default is whitespace. converters : dict or callable, optional - A function to parse all columns strings into the desired value, or - a dictionary mapping column number to a parser function. - E.g. if column 0 is a date string: ``converters = {0: datestr2num}``. - Converters can also be used to provide a default value for missing - data, e.g. ``converters = lambda s: float(s.strip() or 0)`` will - convert empty fields to 0. + Converter functions to customize value parsing. If `converters` is + callable, the function is applied to all columns, else it must be a + dict that maps column number to a parser function. + See examples for further details. Default: None. .. versionchanged:: 1.23.0 |