@@ -3692,14 +3692,34 @@ def as_blocks(self, copy=True):
3692
3692
Convert the frame to a dict of dtype -> Constructor Types that each has
3693
3693
a homogeneous dtype.
3694
3694
3695
+ .. deprecated:: 0.21.0
3696
+
3695
3697
NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
3696
3698
as_matrix)
3697
3699
3698
3700
Parameters
3699
3701
----------
3700
3702
copy : boolean, default True
3701
3703
3702
- .. versionadded: 0.16.1
3704
+ Returns
3705
+ -------
3706
+ values : a dict of dtype -> Constructor Types
3707
+ """
3708
+ warnings .warn ("as_blocks is deprecated and will "
3709
+ "be removed in a future version" ,
3710
+ FutureWarning , stacklevel = 2 )
3711
+ return self ._as_blocks (copy = copy )
3712
+
3713
+ def _as_blocks (self , copy = True ):
3714
+ """
3715
+ Convert the frame to a dict of dtype -> Constructor Types that each has
3716
+ a homogeneous dtype.
3717
+
3718
+ Internal routine only
3719
+
3720
+ Parameters
3721
+ ----------
3722
+ copy : boolean, default True
3703
3723
3704
3724
Returns
3705
3725
-------
@@ -3722,7 +3742,11 @@ def as_blocks(self, copy=True):
3722
3742
3723
3743
@property
3724
3744
def blocks (self ):
3725
- """Internal property, property synonym for as_blocks()"""
3745
+ """
3746
+ Internal property, property synonym for as_blocks()
3747
+
3748
+ .. deprecated:: 0.21.0
3749
+ """
3726
3750
return self .as_blocks ()
3727
3751
3728
3752
@deprecate_kwarg (old_arg_name = 'raise_on_error' , new_arg_name = 'errors' ,
@@ -3931,13 +3955,12 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
3931
3955
-------
3932
3956
converted : same as input object
3933
3957
"""
3934
- from warnings import warn
3935
3958
msg = ("convert_objects is deprecated. To re-infer data dtypes for "
3936
3959
"object columns, use {klass}.infer_objects()\n For all "
3937
3960
"other conversions use the data-type specific converters "
3938
3961
"pd.to_datetime, pd.to_timedelta and pd.to_numeric."
3939
3962
).format (klass = self .__class__ .__name__ )
3940
- warn (msg , FutureWarning , stacklevel = 2 )
3963
+ warnings . warn (msg , FutureWarning , stacklevel = 2 )
3941
3964
3942
3965
return self ._constructor (
3943
3966
self ._data .convert (convert_dates = convert_dates ,
@@ -4310,9 +4333,9 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
4310
4333
raise AssertionError ("'to_replace' must be 'None' if 'regex' is "
4311
4334
"not a bool" )
4312
4335
if axis is not None :
4313
- from warnings import warn
4314
- warn ( 'the "axis" argument is deprecated and will be removed in'
4315
- 'v0.13; this argument has no effect' )
4336
+ warnings . warn ( 'the "axis" argument is deprecated '
4337
+ ' and will be removed in'
4338
+ 'v0.13; this argument has no effect' )
4316
4339
4317
4340
self ._consolidate_inplace ()
4318
4341
0 commit comments