summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/textreading/str_to_int.c11
-rw-r--r--numpy/core/tests/test_deprecations.py2
2 files changed, 9 insertions, 4 deletions
diff --git a/numpy/core/src/multiarray/textreading/str_to_int.c b/numpy/core/src/multiarray/textreading/str_to_int.c
index 1f0d2298e..0dd6c0b0e 100644
--- a/numpy/core/src/multiarray/textreading/str_to_int.c
+++ b/numpy/core/src/multiarray/textreading/str_to_int.c
@@ -12,9 +12,14 @@
const char *deprecation_msg = (
- "loadtxt(): Parsing an integer via a float Deprecated.\n"
- " Please see <> for more information.\n"
- " (Deprecated NumPy 1.23)");
+ "loadtxt(): Parsing an integer via a float is deprecated. To avoid "
+ "this warning, you can:\n"
+ " * make sure the original data is stored as integers.\n"
+ " * use the `converters=` keyword argument. If you only use\n"
+ " NumPy 1.23 or later, `converters=float` will normally work.\n"
+ " * Use `np.loadtxt(...).astype(np.int64)` parsing the file as\n"
+ " floating point and then convert it. (On all NumPy versions.)\n"
+ " (Deprecated NumPy 1.23)");
#define DECLARE_TO_INT(intw, INT_MIN, INT_MAX, byteswap_unaligned) \
NPY_NO_EXPORT int \
diff --git a/numpy/core/tests/test_deprecations.py b/numpy/core/tests/test_deprecations.py
index ec33a9d97..a10dacd49 100644
--- a/numpy/core/tests/test_deprecations.py
+++ b/numpy/core/tests/test_deprecations.py
@@ -1216,7 +1216,7 @@ class TestAxisNotMAXDIMS(_DeprecationTestCase):
class TestLoadtxtParseIntsViaFloat(_DeprecationTestCase):
- message = r"loadtxt\(\): Parsing an integer via a float Deprecated.*"
+ message = r"loadtxt\(\): Parsing an integer via a float is deprecated.*"
@pytest.mark.parametrize("dtype", np.typecodes["AllInteger"])
def test_deprecated_warning(self, dtype):