Skip to content

Commit b72cfb5

Browse files
committed
API: removed functions and methods deprecated in 0.4 Series, address GH #229
1 parent 36345fd commit b72cfb5

File tree

6 files changed

+49
-209
lines changed

6 files changed

+49
-209
lines changed

RELEASE.rst

+46
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,52 @@ pandas 0.5.0
2222
- Changed `buffer` argument name in `Series.to_string` to `buf`
2323
- `Series.to_string` and `DataFrame.to_string` now return strings by default
2424
instead of printing to sys.stdout
25+
- Series functions renamed (and thus deprecated) in 0.4 series have been
26+
removed:
27+
28+
* `asOf`, use `asof`
29+
* `toDict`, use `to_dict`
30+
* `toString`, use `to_string`
31+
* `toCSV`, use `to_csv`
32+
* `merge`, use `map`
33+
* `applymap`, use `apply`
34+
* `combineFirst`, use `combine_first`
35+
* `_firstTimeWithValue` use `first_valid_index`
36+
* `_lastTimeWithValue` use `last_valid_index`
37+
38+
- DataFrame functions renamed / deprecated in 0.4 series have been removed:
39+
40+
* `asMatrix` method, use `as_matrix` or `values` attribute
41+
* `combineFirst`, use `combine_first`
42+
* `getXS`, use `xs`
43+
* `merge`, use `join`
44+
* `fromRecords`, use `from_records`
45+
* `fromcsv`, use `from_csv`
46+
* `toRecords`, use `to_records`
47+
* `toDict`, use `to_dict`
48+
* `toString`, use `to_string`
49+
* `toCSV`, use `to_csv`
50+
* `_firstTimeWithValue` use `first_valid_index`
51+
* `_lastTimeWithValue` use `last_valid_index`
52+
* `toDataMatrix` is no longer needed
53+
* `rows()` method, use `index` attribute
54+
* `cols()` method, use `columns` attribute
55+
* `dropEmptyRows()`, use `dropna(how='all')`
56+
* `dropIncompleteRows()`, use `dropna()`
57+
* `tapply(f)`, use `apply(f, axis=1)`
58+
* `tgroupby(keyfunc, aggfunc)`, use `groupby` with `axis=1`
59+
60+
- Other outstanding deprecations have been removed:
61+
62+
* `indexField` argument in `DataFrame.from_records`
63+
* `missingAtEnd` argument in `Series.order`. Use `na_last` instead
64+
* `Series.fromValue` classmethod, use regular `Series` constructor instead
65+
* Functions `parseCSV`, `parseText`, and `parseExcel` methods in
66+
`pandas.io.parsers` have been removed
67+
* `Index.asOfDate` function
68+
* `Panel.getMinorXS` (use `minor_xs`) and `Panel.getMajorXS` (use
69+
`major_xs`)
70+
* `Panel.toWide`, use `Panel.to_wide` instead
2571

2672
**New features / modules**
2773

pandas/core/frame.py

+1-127
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import csv
1717
import operator
1818
import sys
19-
import warnings
2019

2120
from numpy import nan
2221
import numpy as np
@@ -30,7 +29,6 @@
3029
from pandas.core.indexing import _NDFrameIndexer, _maybe_droplevels
3130
from pandas.core.internals import BlockManager, make_block, form_blocks
3231
from pandas.core.series import Series, _is_bool_indexer
33-
from pandas.util.decorators import deprecate
3432
from pandas.util import py3compat
3533
import pandas.core.common as common
3634
import pandas.core.datetools as datetools
@@ -355,8 +353,7 @@ def to_dict(self):
355353
return dict((k, v.to_dict()) for k, v in self.iteritems())
356354

357355
@classmethod
358-
def from_records(cls, data, index=None, indexField=None,
359-
exclude=None):
356+
def from_records(cls, data, index=None, exclude=None):
360357
"""
361358
Convert structured or record ndarray to DataFrame
362359
@@ -371,11 +368,6 @@ def from_records(cls, data, index=None, indexField=None,
371368
-------
372369
df : DataFrame
373370
"""
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-
379371
columns, sdict = _rec_to_dict(data)
380372

381373
if exclude is None:
@@ -2943,124 +2935,6 @@ def combineMult(self, other):
29432935
"""
29442936
return self.mul(other, fill_value=1.)
29452937

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-
30642938
def group_agg(values, bounds, f):
30652939
"""
30662940
R-style aggregator

pandas/core/index.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from pandas.core.common import (adjoin as _adjoin, _stringify,
99
_is_bool_indexer, _asarray_tuplesafe)
10-
from pandas.util.decorators import deprecate, cache_readonly
10+
from pandas.util.decorators import cache_readonly
1111
import pandas._tseries as lib
1212

1313
__all__ = ['Index']
@@ -595,11 +595,6 @@ def copy(self, order='C'):
595595
cp.__dict__.update(self.__dict__)
596596
return cp
597597

598-
#----------------------------------------------------------------------
599-
# deprecated stuff
600-
601-
asOfDate = deprecate('asOfDate', asof)
602-
603598

604599
class Int64Index(Index):
605600

pandas/core/panel.py

-9
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from pandas.core.frame import DataFrame, _union_indexes
1515
from pandas.core.generic import AxisProperty, NDFrame
1616
from pandas.core.series import Series
17-
from pandas.util.decorators import deprecate
1817
from pandas.util import py3compat
1918
import pandas.core.common as common
2019
import pandas._tseries as _tseries
@@ -1080,12 +1079,6 @@ def _get_join_index(self, other, how):
10801079
join_minor = self.minor_axis.union(other.minor_axis)
10811080
return join_major, join_minor
10821081

1083-
#----------------------------------------------------------------------
1084-
# Deprecated stuff
1085-
1086-
getMinorXS = deprecate('getMinorXS', minor_xs)
1087-
getMajorXS = deprecate('getMajorXS', major_xs)
1088-
10891082
WidePanel = Panel
10901083

10911084
#-------------------------------------------------------------------------------
@@ -1277,8 +1270,6 @@ def _to_wide_mixed(self, mask):
12771270
columns=self.minor_axis)
12781271
return Panel.from_dict(data)
12791272

1280-
toWide = deprecate('toWide', to_wide)
1281-
12821273
def toCSV(self, path):
12831274
def format_cols(items):
12841275
cols = ['Major', 'Minor'] + list(items)

pandas/core/series.py

+1-27
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import csv
99
import itertools
1010
import operator
11-
import sys
12-
import warnings
1311

1412
from numpy import nan, ndarray
1513
import numpy as np
@@ -20,7 +18,6 @@
2018
from pandas.core.generic import PandasObject
2119
from pandas.core.index import Index, MultiIndex, _ensure_index
2220
from pandas.core.indexing import _SeriesIndexer, _maybe_droplevels
23-
from pandas.util.decorators import deprecate
2421
from pandas.util import py3compat
2522
import pandas.core.common as common
2623
import pandas.core.datetools as datetools
@@ -1156,7 +1153,7 @@ def argsort(self, axis=0, kind='quicksort', order=None):
11561153
else:
11571154
return Series(np.argsort(values), index=self.index, name=self.name)
11581155

1159-
def order(self, na_last=True, ascending=True, **kwds):
1156+
def order(self, na_last=True, ascending=True):
11601157
"""
11611158
Sorts Series object, by value, maintaining index-value link
11621159
@@ -1179,11 +1176,6 @@ def _try_mergesort(arr):
11791176
# stable sort not available for object dtype
11801177
return arr.argsort()
11811178

1182-
if 'missingAtEnd' in kwds: # pragma: no cover
1183-
warnings.warn("missingAtEnd is deprecated, use na_last",
1184-
FutureWarning)
1185-
na_last = kwds['missingAtEnd']
1186-
11871179
arr = self.values
11881180
sortedIdx = np.empty(len(self), dtype=np.int32)
11891181

@@ -1852,24 +1844,6 @@ def mapper_f(x):
18521844
def weekday(self):
18531845
return Series([d.weekday() for d in self.index], index=self.index)
18541846

1855-
#----------------------------------------------------------------------
1856-
# Deprecated stuff
1857-
1858-
@classmethod
1859-
def fromValue(cls, value=nan, index=None, dtype=None): # pragma: no cover
1860-
warnings.warn("'fromValue', can call Series(value, index=index) now",
1861-
FutureWarning)
1862-
return Series(value, index=index, dtype=dtype)
1863-
1864-
asOf = deprecate('asOf', asof)
1865-
toDict = deprecate('toDict', to_dict)
1866-
toString = deprecate('toString', to_string)
1867-
merge = deprecate('merge', map)
1868-
applymap = deprecate('applymap', apply)
1869-
combineFirst = deprecate('combineFirst', combine_first)
1870-
_firstTimeWithValue = deprecate('_firstTimeWithValue', first_valid_index)
1871-
_lastTimeWithValue = deprecate('_lastTimeWithValue', last_valid_index)
1872-
toCSV = deprecate('toCSV', to_csv)
18731847

18741848
class TimeSeries(Series):
18751849
pass

pandas/io/parsers.py

-40
Original file line numberDiff line numberDiff line change
@@ -379,43 +379,3 @@ def parse(self, sheetname, header=0, skiprows=None, index_col=None,
379379
return _simple_parser(data, header=header, index_col=index_col,
380380
parse_dates=parse_dates, date_parser=date_parser,
381381
na_values=na_values)
382-
383-
#-------------------------------------------------------------------------------
384-
# Deprecated stuff
385-
386-
import warnings
387-
388-
def parseCSV(filepath, header=0, skiprows=None, indexCol=0,
389-
na_values=None): # pragma: no cover
390-
"""
391-
Parse CSV file into a DataFrame object. Try to parse dates if possible.
392-
"""
393-
warnings.warn("parseCSV is deprecated. Use read_csv instead", FutureWarning)
394-
return read_csv(filepath, header=header, skiprows=skiprows,
395-
index_col=indexCol, na_values=na_values,
396-
parse_dates=True)
397-
398-
def parseText(filepath, sep='\t', header=0,
399-
indexCol=0, colNames=None): # pragma: no cover
400-
"""
401-
Parse whitespace separated file into a DataFrame object.
402-
Try to parse dates if possible.
403-
"""
404-
warnings.warn("parseText is deprecated. Use read_table instead",
405-
FutureWarning)
406-
return read_table(filepath, sep=sep, header=header, index_col=indexCol,
407-
names=colNames, parse_dates=True)
408-
409-
410-
def parseExcel(filepath, header=None, indexCol=0,
411-
sheetname=None, **kwds): # pragma: no cover
412-
"""
413-
414-
"""
415-
warnings.warn("parseExcel is deprecated. Use the ExcelFile class instead",
416-
FutureWarning)
417-
excel_file = ExcelFile(filepath)
418-
return excel_file.parse(sheetname, header=header, index_col=indexCol,
419-
parse_dates=True)
420-
421-

0 commit comments

Comments
 (0)