File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -3736,7 +3736,7 @@ def _get_bool_data(self):
3736
3736
def as_matrix (self , columns = None ):
3737
3737
"""
3738
3738
DEPRECATED: This method will be removed in a future version.
3739
- Use :meth:`NDFrame .values` instead.
3739
+ Use :meth:`DataFrame .values` instead.
3740
3740
3741
3741
Convert the frame to its Numpy-array representation.
3742
3742
@@ -3773,8 +3773,8 @@ def as_matrix(self, columns=None):
3773
3773
--------
3774
3774
pandas.DataFrame.values
3775
3775
"""
3776
- warnings .warn ("This method will be removed in a future version. "
3777
- "Use `` .values`` instead." )
3776
+ warnings .warn (".as_matrix will be removed in a future version. "
3777
+ "Use .values instead." , FutureWarning , stacklevel = 2 )
3778
3778
self ._consolidate_inplace ()
3779
3779
if self ._AXIS_REVERSED :
3780
3780
return self ._data .as_matrix (columns ).T
Original file line number Diff line number Diff line change @@ -369,6 +369,12 @@ def test_values(self):
369
369
self .frame .values [:, 0 ] = 5.
370
370
assert (self .frame .values [:, 0 ] == 5 ).all ()
371
371
372
+ def test_as_matrix_deprecated (self ):
373
+ with tm .assert_produces_warning (FutureWarning ):
374
+ result = self .frame .as_matrix ()
375
+ expected = self .frame .values
376
+ tm .assert_numpy_array_equal (result , expected )
377
+
372
378
def test_deepcopy (self ):
373
379
cp = deepcopy (self .frame )
374
380
series = cp ['A' ]
You can’t perform that action at this time.
0 commit comments