16
16
import csv
17
17
import operator
18
18
import sys
19
- import warnings
20
19
21
20
from numpy import nan
22
21
import numpy as np
30
29
from pandas .core .indexing import _NDFrameIndexer , _maybe_droplevels
31
30
from pandas .core .internals import BlockManager , make_block , form_blocks
32
31
from pandas .core .series import Series , _is_bool_indexer
33
- from pandas .util .decorators import deprecate
34
32
from pandas .util import py3compat
35
33
import pandas .core .common as common
36
34
import pandas .core .datetools as datetools
@@ -355,8 +353,7 @@ def to_dict(self):
355
353
return dict ((k , v .to_dict ()) for k , v in self .iteritems ())
356
354
357
355
@classmethod
358
- def from_records (cls , data , index = None , indexField = None ,
359
- exclude = None ):
356
+ def from_records (cls , data , index = None , exclude = None ):
360
357
"""
361
358
Convert structured or record ndarray to DataFrame
362
359
@@ -371,11 +368,6 @@ def from_records(cls, data, index=None, indexField=None,
371
368
-------
372
369
df : DataFrame
373
370
"""
374
- if indexField is not None : # pragma: no cover
375
- warnings .warn ("indexField argument is deprecated. Use index "
376
- "instead" , FutureWarning )
377
- index = indexField
378
-
379
371
columns , sdict = _rec_to_dict (data )
380
372
381
373
if exclude is None :
@@ -2943,124 +2935,6 @@ def combineMult(self, other):
2943
2935
"""
2944
2936
return self .mul (other , fill_value = 1. )
2945
2937
2946
- def toDataMatrix (self ): # pragma: no cover
2947
- warnings .warn ("toDataMatrix will disappear in next release "
2948
- "as there is no longer a DataMatrix class" ,
2949
- FutureWarning )
2950
- return self .copy ()
2951
-
2952
- def rows (self ): # pragma: no cover
2953
- """Alias for the frame's index"""
2954
- warnings .warn ("Replace usage of .rows() with .index, will be removed "
2955
- "in next release" , FutureWarning )
2956
- return self .index
2957
-
2958
- def cols (self ): # pragma: no cover
2959
- """Return sorted list of frame's columns"""
2960
- warnings .warn ("Replace usage of .cols() with .columns, will be "
2961
- "removed in next release" , FutureWarning )
2962
- return list (self .columns )
2963
-
2964
- def asMatrix (self , * args , ** kwargs ): # pragma: no cover
2965
- warnings .warn ("asMatrix is deprecated. Use 'as_matrix' or .values "
2966
- "instead" , FutureWarning )
2967
- return self .as_matrix (* args , ** kwargs )
2968
-
2969
- @classmethod
2970
- def fromRecords (cls , * args , ** kwargs ): # pragma: no cover
2971
- warnings .warn ("fromRecords is deprecated. Use 'from_records' "
2972
- "instead" , FutureWarning )
2973
- return cls .from_records (* args , ** kwargs )
2974
-
2975
- @classmethod
2976
- def fromcsv (cls , * args , ** kwargs ): # pragma: no cover
2977
- warnings .warn ("fromcsv is deprecated. Use 'from_csv' "
2978
- "instead" , FutureWarning )
2979
- return cls .from_csv (* args , ** kwargs )
2980
-
2981
- combineFirst = deprecate ('combineFirst' , combine_first )
2982
- getXS = deprecate ('getXS' , xs )
2983
- merge = deprecate ('merge' , join )
2984
- toRecords = deprecate ('toRecords' , to_records )
2985
- toDict = deprecate ('toDict' , to_dict )
2986
- toString = deprecate ('toString' , to_string )
2987
- _firstTimeWithValue = deprecate ('_firstTimeWithValue' , first_valid_index )
2988
- _lastTimeWithValue = deprecate ('_lastTimeWithValue' , last_valid_index )
2989
- toCSV = deprecate ('toCSV' , to_csv )
2990
-
2991
- def dropEmptyRows (self , specificColumns = None ): # pragma: no cover
2992
- """
2993
- Return DataFrame with rows omitted containing ALL NaN values
2994
- for optionally specified set of columns.
2995
-
2996
- Parameters
2997
- ----------
2998
- specificColumns : list-like, optional keyword
2999
- Columns to consider in removing NaN values. As a typical
3000
- application, you might provide the list of the columns involved in
3001
- a regression to exlude all the missing data in one shot.
3002
-
3003
- Returns
3004
- -------
3005
- This DataFrame with rows containing any NaN values deleted
3006
- """
3007
- warnings .warn ("dropEmptyRows is deprecated. Use dropna(how='all')" ,
3008
- FutureWarning )
3009
- return self .dropna (axis = 0 , subset = specificColumns , how = 'all' )
3010
-
3011
- def dropIncompleteRows (self , specificColumns = None ,
3012
- minObs = None ): # pragma: no cover
3013
- """
3014
- Return DataFrame with rows omitted containing ANY NaN values for
3015
- optionally specified set of columns.
3016
-
3017
- Parameters
3018
- ----------
3019
- minObs : int or None (default)
3020
- Instead of requiring all the columns to have observations, require
3021
- only minObs observations
3022
- specificColumns : list-like, optional keyword
3023
- Columns to consider in removing NaN values. As a typical
3024
- application, you might provide the list of the columns involved in
3025
- a regression to exlude all the missing data in one shot.
3026
-
3027
- Returns
3028
- -------
3029
- This DataFrame with rows containing any NaN values deleted
3030
-
3031
- """
3032
- warnings .warn ("dropEmptyRows is deprecated. Use dropna()" ,
3033
- FutureWarning )
3034
- if minObs is None :
3035
- return self .dropna (axis = 0 , subset = specificColumns , how = 'any' )
3036
- else :
3037
- return self .dropna (axis = 0 , subset = specificColumns , thresh = minObs )
3038
-
3039
- def tapply (self , func ): # pragma: no cover
3040
- """
3041
- Apply func to the transposed DataFrame, results as per apply
3042
- """
3043
- warnings .warn ("tapply is deprecated. Use apply(f, axis=1)" ,
3044
- FutureWarning )
3045
- return self .apply (func , axis = 1 )
3046
-
3047
- def tgroupby (self , keyfunc , applyfunc ): # pragma: no cover
3048
- """
3049
- Aggregate columns based on passed function
3050
-
3051
- Parameters
3052
- ----------
3053
- keyfunc : function
3054
- applyfunc : function
3055
-
3056
- Returns
3057
- -------
3058
- y : DataFrame
3059
- """
3060
- warnings .warn ("tgroupby is deprecated. Use groupby with axis=1" ,
3061
- FutureWarning )
3062
- return self .T .groupby (keyfunc ).aggregate (applyfunc ).T
3063
-
3064
2938
def group_agg (values , bounds , f ):
3065
2939
"""
3066
2940
R-style aggregator
0 commit comments