summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-01-26 08:49:45 +0200
committerGitHub <noreply@github.com>2021-01-26 08:49:45 +0200
commitaf51d6615c37f43b6d842b72a4b02dc14e024f3e (patch)
tree76344e5ea87f8e0db649e2fc2ad163ce6f51588b /doc
parentc90cb814567b4f798e884b773fe96e42d8aa63de (diff)
parent38bda3ce9e6dc075548f378806488ad152c2e46c (diff)
downloadnumpy-af51d6615c37f43b6d842b72a4b02dc14e024f3e.tar.gz
Merge pull request #18116 from seberg/futurewarn-string-promotion
DEP: Deprecate promotion of numbers and bool to string
Diffstat (limited to 'doc')
-rw-r--r--doc/release/upcoming_changes/18116.future.rst29
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/18116.future.rst b/doc/release/upcoming_changes/18116.future.rst
new file mode 100644
index 000000000..1341d022f
--- /dev/null
+++ b/doc/release/upcoming_changes/18116.future.rst
@@ -0,0 +1,29 @@
+Promotion of strings with numbers and bools is deprecated
+---------------------------------------------------------
+Any promotion of numbers and strings is deprecated and will
+give a ``FutureWarning`` the main affected functionalities
+are:
+
+* `numpy.promote_types` and `numpy.result_type` which will raise
+ an error in this case in the future.
+* `numpy.concatenate` will raise an error when concatenating a string
+ and numeric array. You can use ``dtype="S"`` to explicitly request
+ a string result.
+* `numpy.array` and related functions will start returning ``object``
+ arrays because these functions use ``object`` as a fallback when
+ no common dtype can be found. (In this case setting the
+ ``FutureWarning`` to be raised will unfortunately lead to the new
+ behaviour)
+
+This will mainly affect code such as::
+
+ np.asarray(['string', 0])
+
+and::
+
+ np.concatenate((['string'], [0]))
+
+in both cases adding ``dtype="U"`` or ``dtype="S"`` will give the
+previous (string) result.
+
+Comparisons, universal functions, and casting are not affected by this.