@@ -1650,7 +1650,7 @@ def to_xarray(self):
16501650 coords = coords ,
16511651 )
16521652
1653- _shared_docs ['to_latex' ] = """
1653+ _shared_docs ['to_latex' ] = r """
16541654 Render an object to a tabular environment table. You can splice
16551655 this into a LaTeX document. Requires \\usepackage{booktabs}.
16561656
@@ -3271,7 +3271,7 @@ def sample(self, n=None, frac=None, replace=False, weights=None,
32713271 locs = rs .choice (axis_length , size = n , replace = replace , p = weights )
32723272 return self .take (locs , axis = axis , is_copy = False )
32733273
3274- _shared_docs ['pipe' ] = ("""
3274+ _shared_docs ['pipe' ] = (r """
32753275 Apply func(self, \*args, \*\*kwargs)
32763276
32773277 Parameters
@@ -3692,39 +3692,43 @@ def as_blocks(self, copy=True):
36923692 Convert the frame to a dict of dtype -> Constructor Types that each has
36933693 a homogeneous dtype.
36943694
3695+ .. deprecated:: 0.21.0
3696+
36953697 NOTE: the dtypes of the blocks WILL BE PRESERVED HERE (unlike in
36963698 as_matrix)
36973699
36983700 Parameters
36993701 ----------
37003702 copy : boolean, default True
37013703
3702- .. versionadded: 0.16.1
3703-
37043704 Returns
37053705 -------
37063706 values : a dict of dtype -> Constructor Types
37073707 """
3708- self ._consolidate_inplace ()
3709-
3710- bd = {}
3711- for b in self ._data .blocks :
3712- bd .setdefault (str (b .dtype ), []).append (b )
3713-
3714- result = {}
3715- for dtype , blocks in bd .items ():
3716- # Must combine even after consolidation, because there may be
3717- # sparse items which are never consolidated into one block.
3718- combined = self ._data .combine (blocks , copy = copy )
3719- result [dtype ] = self ._constructor (combined ).__finalize__ (self )
3720-
3721- return result
3708+ warnings .warn ("as_blocks is deprecated and will "
3709+ "be removed in a future version" ,
3710+ FutureWarning , stacklevel = 2 )
3711+ return self ._to_dict_of_blocks (copy = copy )
37223712
37233713 @property
37243714 def blocks (self ):
3725- """Internal property, property synonym for as_blocks()"""
3715+ """
3716+ Internal property, property synonym for as_blocks()
3717+
3718+ .. deprecated:: 0.21.0
3719+ """
37263720 return self .as_blocks ()
37273721
3722+ def _to_dict_of_blocks (self , copy = True ):
3723+ """
3724+ Return a dict of dtype -> Constructor Types that
3725+ each is a homogeneous dtype.
3726+
3727+ Internal ONLY
3728+ """
3729+ return {k : self ._constructor (v ).__finalize__ (self )
3730+ for k , v , in self ._data .to_dict (copy = copy ).items ()}
3731+
37283732 @deprecate_kwarg (old_arg_name = 'raise_on_error' , new_arg_name = 'errors' ,
37293733 mapping = {True : 'raise' , False : 'ignore' })
37303734 def astype (self , dtype , copy = True , errors = 'raise' , ** kwargs ):
@@ -3931,13 +3935,12 @@ def convert_objects(self, convert_dates=True, convert_numeric=False,
39313935 -------
39323936 converted : same as input object
39333937 """
3934- from warnings import warn
39353938 msg = ("convert_objects is deprecated. To re-infer data dtypes for "
39363939 "object columns, use {klass}.infer_objects()\n For all "
39373940 "other conversions use the data-type specific converters "
39383941 "pd.to_datetime, pd.to_timedelta and pd.to_numeric."
39393942 ).format (klass = self .__class__ .__name__ )
3940- warn (msg , FutureWarning , stacklevel = 2 )
3943+ warnings . warn (msg , FutureWarning , stacklevel = 2 )
39413944
39423945 return self ._constructor (
39433946 self ._data .convert (convert_dates = convert_dates ,
@@ -4310,9 +4313,9 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
43104313 raise AssertionError ("'to_replace' must be 'None' if 'regex' is "
43114314 "not a bool" )
43124315 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' )
4316+ warnings . warn ( 'the "axis" argument is deprecated '
4317+ ' and will be removed in'
4318+ 'v0.13; this argument has no effect' )
43164319
43174320 self ._consolidate_inplace ()
43184321
0 commit comments