From 2340783086d8d86dea840ad966bb2c36113afbc6 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Mon, 3 Oct 2022 10:24:44 -0700 Subject: [PATCH 1/2] DOC: Update delimiter param description. Explicitly state that only single-character delimiters are supported. --- numpy/lib/npyio.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 3336e1d07edc..d97291476615 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1087,7 +1087,8 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, comment. None implies no comments. For backwards compatibility, byte strings will be decoded as 'latin1'. The default is '#'. delimiter : str, optional - The string used to separate values. For backwards compatibility, byte + The character used to separate the values. Only single character + delimiters are supported. 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 From 2812cc46add209bd5d5fc24a2f3c207cec2f9615 Mon Sep 17 00:00:00 2001 From: Ross Barnowski Date: Tue, 4 Oct 2022 21:38:46 -0700 Subject: [PATCH 2/2] DOC: Use versionchanged and add in note about newline chars. --- numpy/lib/npyio.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index d97291476615..f0ec40a2eae8 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1087,9 +1087,13 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, comment. None implies no comments. For backwards compatibility, byte strings will be decoded as 'latin1'. The default is '#'. delimiter : str, optional - The character used to separate the values. Only single character - delimiters are supported. For backwards compatibility, byte - strings will be decoded as 'latin1'. The default is whitespace. + The character used to separate the values. For backwards compatibility, + byte strings will be decoded as 'latin1'. The default is whitespace. + + .. versionchanged:: 1.23.0 + Only single character delimiters are supported. Newline characters + cannot be used as the delimiter. + 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.