@@ -2534,11 +2534,8 @@ def copy(self, deep=True):
25342534 data = self ._data .copy (deep = deep )
25352535 return self ._constructor (data ).__finalize__ (self )
25362536
2537- @deprecate_kwarg (old_arg_name = 'convert_dates' , new_arg_name = 'datetime' )
2538- @deprecate_kwarg (old_arg_name = 'convert_numeric' , new_arg_name = 'numeric' )
2539- @deprecate_kwarg (old_arg_name = 'convert_timedeltas' , new_arg_name = 'timedelta' )
2540- def convert_objects (self , datetime = False , numeric = False ,
2541- timedelta = False , coerce = False , copy = True ):
2537+ def _convert (self , datetime = False , numeric = False , timedelta = False ,
2538+ coerce = False , copy = True ):
25422539 """
25432540 Attempt to infer better dtype for object columns
25442541
@@ -2563,31 +2560,48 @@ def convert_objects(self, datetime=False, numeric=False,
25632560 -------
25642561 converted : same as input object
25652562 """
2563+ return self ._constructor (
2564+ self ._data .convert (datetime = datetime ,
2565+ numeric = numeric ,
2566+ timedelta = timedelta ,
2567+ coerce = coerce ,
2568+ copy = copy )).__finalize__ (self )
2569+
2570+ # TODO: Remove in 0.18 or 2017, which ever is sooner
2571+ def convert_objects (self , convert_dates = True , convert_numeric = False ,
2572+ convert_timedeltas = True , copy = True ):
2573+ """
2574+ Attempt to infer better dtype for object columns
2575+
2576+ Parameters
2577+ ----------
2578+ convert_dates : boolean, default True
2579+ If True, convert to date where possible. If 'coerce', force
2580+ conversion, with unconvertible values becoming NaT.
2581+ convert_numeric : boolean, default False
2582+ If True, attempt to coerce to numbers (including strings), with
2583+ unconvertible values becoming NaN.
2584+ convert_timedeltas : boolean, default True
2585+ If True, convert to timedelta where possible. If 'coerce', force
2586+ conversion, with unconvertible values becoming NaT.
2587+ copy : boolean, default True
2588+ If True, return a copy even if no copy is necessary (e.g. no
2589+ conversion was done). Note: This is meant for internal use, and
2590+ should not be confused with inplace.
25662591
2567- # Deprecation code to handle usage change
2568- issue_warning = False
2569- if datetime == 'coerce' :
2570- datetime = coerce = True
2571- numeric = timedelta = False
2572- issue_warning = True
2573- elif numeric == 'coerce' :
2574- numeric = coerce = True
2575- datetime = timedelta = False
2576- issue_warning = True
2577- elif timedelta == 'coerce' :
2578- timedelta = coerce = True
2579- datetime = numeric = False
2580- issue_warning = True
2581- if issue_warning :
2582- warnings .warn ("The use of 'coerce' as an input is deprecated. "
2583- "Instead set coerce=True." ,
2584- FutureWarning )
2592+ Returns
2593+ -------
2594+ converted : same as input object
2595+ """
2596+ from warnings import warn
2597+ warn ("convert_objects is deprecated. Use the data-type specific "
2598+ "converters pd.to_datetime, pd.to_timestamp and pd.to_numeric." ,
2599+ FutureWarning , stacklevel = 2 )
25852600
25862601 return self ._constructor (
2587- self ._data .convert (datetime = datetime ,
2588- numeric = numeric ,
2589- timedelta = timedelta ,
2590- coerce = coerce ,
2602+ self ._data .convert (convert_dates = convert_dates ,
2603+ convert_numeric = convert_numeric ,
2604+ convert_timedeltas = convert_timedeltas ,
25912605 copy = copy )).__finalize__ (self )
25922606
25932607 #----------------------------------------------------------------------
0 commit comments