@@ -350,13 +350,6 @@ def _construct_axes_dict(self, axes=None, **kwargs):
350
350
d .update (kwargs )
351
351
return d
352
352
353
- @staticmethod
354
- def _construct_axes_dict_from (self , axes , ** kwargs ):
355
- """Return an axes dictionary for the passed axes."""
356
- d = {a : ax for a , ax in zip (self ._AXIS_ORDERS , axes )}
357
- d .update (kwargs )
358
- return d
359
-
360
353
def _construct_axes_from_arguments (
361
354
self , args , kwargs , require_all : bool = False , sentinel = None
362
355
):
@@ -385,18 +378,6 @@ def _construct_axes_from_arguments(
385
378
axes = {a : kwargs .pop (a , sentinel ) for a in self ._AXIS_ORDERS }
386
379
return axes , kwargs
387
380
388
- @classmethod
389
- def _from_axes (cls : Type [FrameOrSeries ], data , axes , ** kwargs ) -> FrameOrSeries :
390
- # for construction from BlockManager
391
- if isinstance (data , BlockManager ):
392
- return cls (data , ** kwargs )
393
- else :
394
- if cls ._AXIS_REVERSED :
395
- axes = axes [::- 1 ]
396
- d = cls ._construct_axes_dict_from (cls , axes , copy = False )
397
- d .update (kwargs )
398
- return cls (data , ** d )
399
-
400
381
@classmethod
401
382
def _get_axis_number (cls , axis ):
402
383
axis = cls ._AXIS_ALIASES .get (axis , axis )
@@ -911,25 +892,6 @@ def squeeze(self, axis=None):
911
892
)
912
893
]
913
894
914
- def swaplevel (self : FrameOrSeries , i = - 2 , j = - 1 , axis = 0 ) -> FrameOrSeries :
915
- """
916
- Swap levels i and j in a MultiIndex on a particular axis
917
-
918
- Parameters
919
- ----------
920
- i, j : int, str (can be mixed)
921
- Level of index to be swapped. Can pass level name as string.
922
-
923
- Returns
924
- -------
925
- swapped : same type as caller (new object)
926
- """
927
- axis = self ._get_axis_number (axis )
928
- result = self .copy ()
929
- labels = result ._data .axes [axis ]
930
- result ._data .set_axis (axis , labels .swaplevel (i , j ))
931
- return result
932
-
933
895
# ----------------------------------------------------------------------
934
896
# Rename
935
897
@@ -4224,69 +4186,6 @@ def sort_values(
4224
4186
"""
4225
4187
raise AbstractMethodError (self )
4226
4188
4227
- def sort_index (
4228
- self ,
4229
- axis = 0 ,
4230
- level = None ,
4231
- ascending : bool_t = True ,
4232
- inplace : bool_t = False ,
4233
- kind : str = "quicksort" ,
4234
- na_position : str = "last" ,
4235
- sort_remaining : bool_t = True ,
4236
- ignore_index : bool_t = False ,
4237
- ):
4238
- """
4239
- Sort object by labels (along an axis).
4240
-
4241
- Parameters
4242
- ----------
4243
- axis : {0 or 'index', 1 or 'columns'}, default 0
4244
- The axis along which to sort. The value 0 identifies the rows,
4245
- and 1 identifies the columns.
4246
- level : int or level name or list of ints or list of level names
4247
- If not None, sort on values in specified index level(s).
4248
- ascending : bool, default True
4249
- Sort ascending vs. descending.
4250
- inplace : bool, default False
4251
- If True, perform operation in-place.
4252
- kind : {'quicksort', 'mergesort', 'heapsort'}, default 'quicksort'
4253
- Choice of sorting algorithm. See also ndarray.np.sort for more
4254
- information. `mergesort` is the only stable algorithm. For
4255
- DataFrames, this option is only applied when sorting on a single
4256
- column or label.
4257
- na_position : {'first', 'last'}, default 'last'
4258
- Puts NaNs at the beginning if `first`; `last` puts NaNs at the end.
4259
- Not implemented for MultiIndex.
4260
- sort_remaining : bool, default True
4261
- If True and sorting by level and index is multilevel, sort by other
4262
- levels too (in order) after sorting by specified level.
4263
- ignore_index : bool, default False
4264
- If True, the resulting axis will be labeled 0, 1, …, n - 1.
4265
-
4266
- .. versionadded:: 1.0.0
4267
-
4268
- Returns
4269
- -------
4270
- sorted_obj : DataFrame or None
4271
- DataFrame with sorted index if inplace=False, None otherwise.
4272
- """
4273
- inplace = validate_bool_kwarg (inplace , "inplace" )
4274
- axis = self ._get_axis_number (axis )
4275
- axis_name = self ._get_axis_name (axis )
4276
- labels = self ._get_axis (axis )
4277
-
4278
- if level is not None :
4279
- raise NotImplementedError ("level is not implemented" )
4280
- if inplace :
4281
- raise NotImplementedError ("inplace is not implemented" )
4282
-
4283
- sort_index = labels .argsort ()
4284
- if not ascending :
4285
- sort_index = sort_index [::- 1 ]
4286
-
4287
- new_axis = labels .take (sort_index )
4288
- return self .reindex (** {axis_name : new_axis })
4289
-
4290
4189
def reindex (self : FrameOrSeries , * args , ** kwargs ) -> FrameOrSeries :
4291
4190
"""
4292
4191
Conform %(klass)s to new index with optional filling logic.
@@ -5369,11 +5268,6 @@ def _is_numeric_mixed_type(self):
5369
5268
f = lambda : self ._data .is_numeric_mixed_type
5370
5269
return self ._protect_consolidate (f )
5371
5270
5372
- @property
5373
- def _is_datelike_mixed_type (self ):
5374
- f = lambda : self ._data .is_datelike_mixed_type
5375
- return self ._protect_consolidate (f )
5376
-
5377
5271
def _check_inplace_setting (self , value ) -> bool_t :
5378
5272
""" check whether we allow in-place setting with this type of value """
5379
5273
@@ -5482,11 +5376,6 @@ def _values(self) -> np.ndarray:
5482
5376
"""internal implementation"""
5483
5377
return self .values
5484
5378
5485
- @property
5486
- def _get_values (self ) -> np .ndarray :
5487
- # compat
5488
- return self .values
5489
-
5490
5379
def _internal_get_values (self ) -> np .ndarray :
5491
5380
"""
5492
5381
Return an ndarray after converting sparse values to dense.
0 commit comments