@@ -3692,6 +3692,33 @@ 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
+
3697
+ NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
3698
+ as_matrix)
3699
+
3700
+ Parameters
3701
+ ----------
3702
+ copy : boolean, default True
3703
+
3704
+ .. versionadded: 0.16.1
3705
+
3706
+ Returns
3707
+ -------
3708
+ values : a dict of dtype -> Constructor Types
3709
+ """
3710
+ warnings .warn ("as_blocks is deprecated and will "
3711
+ "be removed in a future version" ,
3712
+ FutureWarning , stacklevel = 2 )
3713
+ return self ._as_blocks (copy = copy )
3714
+
3715
+ def _as_blocks (self , copy = True ):
3716
+ """
3717
+ Convert the frame to a dict of dtype -> Constructor Types that each has
3718
+ a homogeneous dtype.
3719
+
3720
+ Internal routine only
3721
+
3695
3722
NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
3696
3723
as_matrix)
3697
3724
@@ -3722,7 +3749,11 @@ def as_blocks(self, copy=True):
3722
3749
3723
3750
@property
3724
3751
def blocks (self ):
3725
- """Internal property, property synonym for as_blocks()"""
3752
+ """
3753
+ Internal property, property synonym for as_blocks()
3754
+
3755
+ .. deprecated:: 0.21.0
3756
+ """
3726
3757
return self .as_blocks ()
3727
3758
3728
3759
@deprecate_kwarg (old_arg_name = 'raise_on_error' , new_arg_name = 'errors' ,
@@ -3931,13 +3962,12 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
3931
3962
-------
3932
3963
converted : same as input object
3933
3964
"""
3934
- from warnings import warn
3935
3965
msg = ("convert_objects is deprecated. To re-infer data dtypes for "
3936
3966
"object columns, use {klass}.infer_objects()\n For all "
3937
3967
"other conversions use the data-type specific converters "
3938
3968
"pd.to_datetime, pd.to_timedelta and pd.to_numeric."
3939
3969
).format (klass = self .__class__ .__name__ )
3940
- warn (msg , FutureWarning , stacklevel = 2 )
3970
+ warnings . warn (msg , FutureWarning , stacklevel = 2 )
3941
3971
3942
3972
return self ._constructor (
3943
3973
self ._data .convert (convert_dates = convert_dates ,
@@ -4310,9 +4340,9 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
4310
4340
raise AssertionError ("'to_replace' must be 'None' if 'regex' is "
4311
4341
"not a bool" )
4312
4342
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' )
4343
+ warnings . warn ( 'the "axis" argument is deprecated '
4344
+ ' and will be removed in'
4345
+ 'v0.13; this argument has no effect' )
4316
4346
4317
4347
self ._consolidate_inplace ()
4318
4348
0 commit comments