Skip to content

Commit 1cfaba2

Browse files
committed
Remove number of deprecated parameters/functions/classes [fix pandas-dev#6641]
1 parent 7c073c4 commit 1cfaba2

File tree

9 files changed

+22
-157
lines changed

9 files changed

+22
-157
lines changed

pandas/core/daterange.py

-48
This file was deleted.

pandas/core/format.py

+3-20
Original file line numberDiff line numberDiff line change
@@ -358,15 +358,10 @@ def _to_str_columns(self):
358358

359359
return strcols
360360

361-
def to_string(self, force_unicode=None):
361+
def to_string(self):
362362
"""
363363
Render a DataFrame to a console-friendly tabular output.
364364
"""
365-
import warnings
366-
if force_unicode is not None: # pragma: no cover
367-
warnings.warn(
368-
"force_unicode is deprecated, it will have no effect",
369-
FutureWarning)
370365

371366
frame = self.frame
372367

@@ -423,8 +418,7 @@ def _join_multiline(self, *strcols):
423418
st = ed
424419
return '\n\n'.join(str_lst)
425420

426-
def to_latex(self, force_unicode=None, column_format=None,
427-
longtable=False):
421+
def to_latex(self, column_format=None, longtable=False):
428422
"""
429423
Render a DataFrame to a LaTeX tabular/longtable environment output.
430424
"""
@@ -435,12 +429,6 @@ def get_col_type(dtype):
435429
else:
436430
return 'l'
437431

438-
import warnings
439-
if force_unicode is not None: # pragma: no cover
440-
warnings.warn(
441-
"force_unicode is deprecated, it will have no effect",
442-
FutureWarning)
443-
444432
frame = self.frame
445433

446434
if len(frame.columns) == 0 or len(frame.index) == 0:
@@ -2139,19 +2127,14 @@ def __call__(self, num):
21392127
return formatted # .strip()
21402128

21412129

2142-
def set_eng_float_format(precision=None, accuracy=3, use_eng_prefix=False):
2130+
def set_eng_float_format(accuracy=3, use_eng_prefix=False):
21432131
"""
21442132
Alter default behavior on how float is formatted in DataFrame.
21452133
Format float in engineering format. By accuracy, we mean the number of
21462134
decimal digits after the floating point.
21472135
21482136
See also EngFormatter.
21492137
"""
2150-
if precision is not None: # pragma: no cover
2151-
import warnings
2152-
warnings.warn("'precision' parameter in set_eng_float_format is "
2153-
"being renamed to 'accuracy'", FutureWarning)
2154-
accuracy = precision
21552138

21562139
set_option("display.float_format", EngFormatter(accuracy, use_eng_prefix))
21572140
set_option("display.column_space", max(12, accuracy + 9))

pandas/core/frame.py

+6-28
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ def to_panel(self):
10711071
@deprecate_kwarg(old_arg_name='cols', new_arg_name='columns')
10721072
def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
10731073
columns=None, header=True, index=True, index_label=None,
1074-
mode='w', nanRep=None, encoding=None, quoting=None,
1074+
mode='w', encoding=None, quoting=None,
10751075
quotechar='"', line_terminator='\n', chunksize=None,
10761076
tupleize_cols=False, date_format=None, doublequote=True,
10771077
escapechar=None, **kwds):
@@ -1128,10 +1128,6 @@ def to_csv(self, path_or_buf=None, sep=",", na_rep='', float_format=None,
11281128
Format string for datetime objects
11291129
cols : kwarg only alias of columns [deprecated]
11301130
"""
1131-
if nanRep is not None: # pragma: no cover
1132-
warnings.warn("nanRep is deprecated, use na_rep",
1133-
FutureWarning)
1134-
na_rep = nanRep
11351131

11361132
formatter = fmt.CSVFormatter(self, path_or_buf,
11371133
line_terminator=line_terminator,
@@ -1275,21 +1271,12 @@ def to_stata(
12751271
@Appender(fmt.docstring_to_string, indents=1)
12761272
def to_string(self, buf=None, columns=None, col_space=None, colSpace=None,
12771273
header=True, index=True, na_rep='NaN', formatters=None,
1278-
float_format=None, sparsify=None, nanRep=None,
1279-
index_names=True, justify=None, force_unicode=None,
1280-
line_width=None, max_rows=None, max_cols=None,
1274+
float_format=None, sparsify=None, index_names=True,
1275+
justify=None, line_width=None, max_rows=None, max_cols=None,
12811276
show_dimensions=False):
12821277
"""
12831278
Render a DataFrame to a console-friendly tabular output.
12841279
"""
1285-
if force_unicode is not None: # pragma: no cover
1286-
warnings.warn("force_unicode is deprecated, it will have no "
1287-
"effect", FutureWarning)
1288-
1289-
if nanRep is not None: # pragma: no cover
1290-
warnings.warn("nanRep is deprecated, use na_rep",
1291-
FutureWarning)
1292-
na_rep = nanRep
12931280

12941281
if colSpace is not None: # pragma: no cover
12951282
warnings.warn("colSpace is deprecated, use col_space",
@@ -1318,9 +1305,8 @@ def to_string(self, buf=None, columns=None, col_space=None, colSpace=None,
13181305
def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
13191306
header=True, index=True, na_rep='NaN', formatters=None,
13201307
float_format=None, sparsify=None, index_names=True,
1321-
justify=None, force_unicode=None, bold_rows=True,
1322-
classes=None, escape=True, max_rows=None, max_cols=None,
1323-
show_dimensions=False):
1308+
justify=None, bold_rows=True, classes=None, escape=True,
1309+
max_rows=None, max_cols=None, show_dimensions=False):
13241310
"""
13251311
Render a DataFrame as an HTML table.
13261312
@@ -1341,10 +1327,6 @@ def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
13411327
13421328
"""
13431329

1344-
if force_unicode is not None: # pragma: no cover
1345-
warnings.warn("force_unicode is deprecated, it will have no "
1346-
"effect", FutureWarning)
1347-
13481330
if colSpace is not None: # pragma: no cover
13491331
warnings.warn("colSpace is deprecated, use col_space",
13501332
FutureWarning)
@@ -1372,7 +1354,7 @@ def to_html(self, buf=None, columns=None, col_space=None, colSpace=None,
13721354
def to_latex(self, buf=None, columns=None, col_space=None, colSpace=None,
13731355
header=True, index=True, na_rep='NaN', formatters=None,
13741356
float_format=None, sparsify=None, index_names=True,
1375-
bold_rows=True, force_unicode=None, longtable=False):
1357+
bold_rows=True, longtable=False):
13761358
"""
13771359
Render a DataFrame to a tabular environment table. You can splice
13781360
this into a LaTeX document. Requires \\usepackage(booktabs}.
@@ -1387,10 +1369,6 @@ def to_latex(self, buf=None, columns=None, col_space=None, colSpace=None,
13871369
13881370
"""
13891371

1390-
if force_unicode is not None: # pragma: no cover
1391-
warnings.warn("force_unicode is deprecated, it will have no "
1392-
"effect", FutureWarning)
1393-
13941372
if colSpace is not None: # pragma: no cover
13951373
warnings.warn("colSpace is deprecated, use col_space",
13961374
FutureWarning)

pandas/core/series.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ def _repr_footer(self):
881881
str(self.dtype.name))
882882

883883
def to_string(self, buf=None, na_rep='NaN', float_format=None,
884-
nanRep=None, length=False, dtype=False, name=False):
884+
length=False, dtype=False, name=False):
885885
"""
886886
Render a string representation of the Series
887887
@@ -906,10 +906,6 @@ def to_string(self, buf=None, na_rep='NaN', float_format=None,
906906
formatted : string (if not buffer passed)
907907
"""
908908

909-
if nanRep is not None: # pragma: no cover
910-
warnings.warn("nanRep is deprecated, use na_rep", FutureWarning)
911-
na_rep = nanRep
912-
913909
the_repr = self._get_repr(float_format=float_format, na_rep=na_rep,
914910
length=length, dtype=dtype, name=name)
915911

pandas/io/data.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,7 @@ def _dl_mult_symbols(symbols, start, end, chunksize, retry_count, pause,
338338

339339

340340
def _get_data_from(symbols, start, end, retry_count, pause, adjust_price,
341-
ret_index, chunksize, source, name):
342-
if name is not None:
343-
warnings.warn("Arg 'name' is deprecated, please use 'symbols' "
344-
"instead.", FutureWarning)
345-
symbols = name
341+
ret_index, chunksize, source):
346342

347343
src_fn = _source_functions[source]
348344

pandas/io/pytables.py

-7
Original file line numberDiff line numberDiff line change
@@ -685,13 +685,6 @@ def select_as_coordinates(
685685
return self.get_storer(key).read_coordinates(where=where, start=start,
686686
stop=stop, **kwargs)
687687

688-
def unique(self, key, column, **kwargs):
689-
warnings.warn("unique(key,column) is deprecated\n"
690-
"use select_column(key,column).unique() instead",
691-
FutureWarning)
692-
return self.get_storer(key).read_column(column=column,
693-
**kwargs).unique()
694-
695688
def select_column(self, key, column, **kwargs):
696689
"""
697690
return a single column from the table. This is generally only useful to

pandas/stats/moments.py

+1-7
Original file line numberDiff line numberDiff line change
@@ -547,13 +547,7 @@ def _prep_binary(arg1, arg2):
547547
# Python interface to Cython functions
548548

549549

550-
def _conv_timerule(arg, freq, time_rule):
551-
if time_rule is not None:
552-
import warnings
553-
warnings.warn("time_rule argument is deprecated, replace with freq",
554-
FutureWarning)
555-
556-
freq = time_rule
550+
def _conv_timerule(arg, freq):
557551

558552
types = (DataFrame, Series)
559553
if freq is not None and isinstance(arg, types):

pandas/tseries/frequencies.py

-15
Original file line numberDiff line numberDiff line change
@@ -239,21 +239,6 @@ def get_period_alias(offset_str):
239239
_legacy_reverse_map = dict((v, k) for k, v in
240240
reversed(sorted(compat.iteritems(_rule_aliases))))
241241

242-
243-
def inferTimeRule(index):
244-
from pandas.tseries.index import DatetimeIndex
245-
import warnings
246-
warnings.warn("This method is deprecated, use infer_freq or inferred_freq"
247-
" attribute of DatetimeIndex", FutureWarning)
248-
249-
freq = DatetimeIndex(index).inferred_freq
250-
if freq is None:
251-
raise Exception('Unable to infer time rule')
252-
253-
offset = to_offset(freq)
254-
return get_legacy_offset_name(offset)
255-
256-
257242
def to_offset(freqstr):
258243
"""
259244
Return DateOffset object from string representation

pandas/tseries/index.py

+10-22
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,6 @@ def __new__(cls, data=None,
158158
dayfirst = kwds.pop('dayfirst', None)
159159
yearfirst = kwds.pop('yearfirst', None)
160160
infer_dst = kwds.pop('infer_dst', False)
161-
warn = False
162-
if 'offset' in kwds and kwds['offset']:
163-
freq = kwds['offset']
164-
warn = True
165161

166162
freq_infer = False
167163
if not isinstance(freq, DateOffset):
@@ -173,27 +169,19 @@ def __new__(cls, data=None,
173169
freq_infer = True
174170
freq = None
175171

176-
if warn:
177-
import warnings
178-
warnings.warn("parameter 'offset' is deprecated, "
179-
"please use 'freq' instead",
180-
FutureWarning)
181-
182-
offset = freq
183-
184172
if periods is not None:
185173
if com.is_float(periods):
186174
periods = int(periods)
187175
elif not com.is_integer(periods):
188176
raise ValueError('Periods must be a number, got %s' %
189177
str(periods))
190178

191-
if data is None and offset is None:
179+
if data is None and freq is None:
192180
raise ValueError("Must provide freq argument if no data is "
193181
"supplied")
194182

195183
if data is None:
196-
return cls._generate(start, end, periods, name, offset,
184+
return cls._generate(start, end, periods, name, freq,
197185
tz=tz, normalize=normalize, closed=closed,
198186
infer_dst=infer_dst)
199187

@@ -211,11 +199,11 @@ def __new__(cls, data=None,
211199

212200
# try a few ways to make it datetime64
213201
if lib.is_string_array(data):
214-
data = _str_to_dt_array(data, offset, dayfirst=dayfirst,
202+
data = _str_to_dt_array(data, freq, dayfirst=dayfirst,
215203
yearfirst=yearfirst)
216204
else:
217205
data = tools.to_datetime(data, errors='raise')
218-
data.offset = offset
206+
data.offset = freq
219207
if isinstance(data, DatetimeIndex):
220208
if name is not None:
221209
data.name = name
@@ -226,7 +214,7 @@ def __new__(cls, data=None,
226214
return data
227215

228216
if issubclass(data.dtype.type, compat.string_types):
229-
data = _str_to_dt_array(data, offset, dayfirst=dayfirst,
217+
data = _str_to_dt_array(data, freq, dayfirst=dayfirst,
230218
yearfirst=yearfirst)
231219

232220
if issubclass(data.dtype.type, np.datetime64):
@@ -238,8 +226,8 @@ def __new__(cls, data=None,
238226

239227
subarr = data.values
240228

241-
if offset is None:
242-
offset = data.offset
229+
if freq is None:
230+
freq = data.offset
243231
verify_integrity = False
244232
else:
245233
if data.dtype != _NS_DTYPE:
@@ -287,13 +275,13 @@ def __new__(cls, data=None,
287275

288276
subarr = subarr.view(cls)
289277
subarr.name = name
290-
subarr.offset = offset
278+
subarr.offset = freq
291279
subarr.tz = tz
292280

293281
if verify_integrity and len(subarr) > 0:
294-
if offset is not None and not freq_infer:
282+
if freq is not None and not freq_infer:
295283
inferred = subarr.inferred_freq
296-
if inferred != offset.freqstr:
284+
if inferred != freq.freqstr:
297285
raise ValueError('Dates do not conform to passed '
298286
'frequency')
299287

0 commit comments

Comments
 (0)