8000 FIX deprecation message for 1d data · scikit-learn/scikit-learn@250507f · GitHub
[go: up one dir, main page]

Skip to content

Commit 250507f

Browse files
committed
FIX deprecation message for 1d data
1 parent 3f9d33c commit 250507f

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

sklearn/preprocessing/data.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@
4646
'minmax_scale',
4747
]
4848

49-
DEPRECATION_MSG_1D = ("Passing 1d arrays as data is deprecated and "
50-
"will be removed in 0.18. Reshape your data either using"
51-
"X.reshape(-1, 1) if your data has a single feature or"
52-
"X.reshape(1, -1) if it contains a single sample.")
49+
DEPRECATION_MSG_1D = (
50+
"Passing 1d arrays as data is deprecated in 0.17 and will "
51+
"raise ValueError in 0.19. Reshape your data either using "
52+
"X.reshape(-1, 1) if your data has a single feature or "
53+
"X.reshape(1, -1) if it contains a single sample."
54+
)
55+
5356

5457
def _mean_and_std(X, axis=0, with_mean=True, with_std=True):
5558
"""Compute mean and std deviation for centering, scaling.

sklearn/utils/validation.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,11 +365,12 @@ def check_array(array, accept_sparse=None, dtype="numeric", order=None,
365365

366366
if ensure_2d:
367367
if array.ndim == 1:
368-
warnings.warn("Passing 1d arrays as data is deprecated and "
369-
"will be removed in 0.18. Reshape your data either using"
370-
"X.reshape(-1, 1) if your data has a single feature or"
371-
"X.reshape(1, -1) if it contains a single sample.",
372-
DeprecationWarning)
368+
warnings.warn(
369+
"Passing 1d arrays as data is deprecated in 0.17 and will"
370+
"raise ValueError in 0.19. Reshape your data either using "
371+
"X.reshape(-1, 1) if your data has a single feature or "
372+
"X.reshape(1, -1) if it contains a single sample.",
373+
DeprecationWarning)
373374
array = np.atleast_2d(array)
374375
# To ensure that array flags are maintained
375376
array = np.array(array, dtype=dtype, order=order, copy=copy)

0 commit comments

Comments
 (0)
0