diff --git a/pandas/core/base.py b/pandas/core/base.py index cc676b9682277..6c0a0c26b6457 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -19,7 +19,7 @@ class StringMixin(object): # Formatting def __unicode__(self): - raise NotImplementedError + raise NotImplementedError("StringMixin __unicode__ format") def __str__(self): """ @@ -382,7 +382,7 @@ def _box_func(self): """ box function to get object from internal representation """ - raise NotImplementedError + raise NotImplementedError("Box function to get object from internal representation") def _box_values(self, values): """ diff --git a/pandas/core/common.py b/pandas/core/common.py index 92d60ae8d8847..bad9a03942277 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -39,6 +39,11 @@ class SettingWithCopyWarning(Warning): class AmbiguousIndexError(PandasError, KeyError): pass +class AbstractMethodError(NotImplementedError): + def __init__(self,m): + self.message = m + def __str__(self): + return "This method must be defined on the concrete class - "+self.message _POSSIBLY_CAST_DTYPES = set([np.dtype(t).name for t in ['O', 'int8', @@ -134,7 +139,7 @@ def _isnull_new(obj): return lib.checknull(obj) # hack (for now) because MI registers as ndarray elif isinstance(obj, pd.MultiIndex): - raise NotImplementedError("isnull is not defined for MultiIndex") + raise AbstractMethodError("isnull is not defined for MultiIndex") elif isinstance(obj, (ABCSeries, np.ndarray)): return _isnull_ndarraylike(obj) elif isinstance(obj, ABCGeneric): @@ -160,7 +165,7 @@ def _isnull_old(obj): return lib.checknull_old(obj) # hack (for now) because MI registers as ndarray elif isinstance(obj, pd.MultiIndex): - raise NotImplementedError("isnull is not defined for MultiIndex") + raise AbstractMethodError("isnull is not defined for MultiIndex") elif isinstance(obj, (ABCSeries, np.ndarray)): return _isnull_ndarraylike_old(obj) elif isinstance(obj, ABCGeneric): diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 756de479a471a..3d4a90ed82592 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -135,7 +135,7 @@ def _init_mgr(self, mgr, axes=None, dtype=None, copy=False): @property def _constructor(self): - raise NotImplementedError + raise NotImplementedError("NDFrame _constructor") def __unicode__(self): # unicode representation based upon iterating over self @@ -150,7 +150,7 @@ def _local_dir(self): @property def _constructor_sliced(self): - raise NotImplementedError + raise NotImplementedError("NDFrame _constructor_sliced") #---------------------------------------------------------------------- # Axis @@ -1073,7 +1073,7 @@ def _iget_item_cache(self, item): return lower def _box_item_values(self, key, values): - raise NotImplementedError + raise NotImplementedError("NDFrame _box_item_values") def _maybe_cache_changed(self, item, value): """ @@ -1653,7 +1653,7 @@ def _needs_reindex_multi(self, axes, method, level): method is None and level is None and not self._is_mixed_type) def _reindex_multi(self, axes, copy, fill_value): - return NotImplemented + raise NotImplementedError("NDFrame _reindex_multi") _shared_docs['reindex_axis'] = ( """Conform input object to new index with optional filling logic, @@ -2179,7 +2179,7 @@ def fillna(self, value=None, method=None, axis=0, inplace=False, raise ValueError('must specify a fill method or value') if self._is_mixed_type and axis == 1: if inplace: - raise NotImplementedError() + raise NotImplementedError("fillna with inplace=True and _is_mixed_type=True and axis=1") result = self.T.fillna(method=method, limit=limit).T # need to downcast here because of all of the transposes @@ -2880,7 +2880,7 @@ def first(self, offset): """ from pandas.tseries.frequencies import to_offset if not isinstance(self.index, DatetimeIndex): - raise NotImplementedError + raise NotImplementedError("Currently implemented for DatatimeIndex instance only") if len(self.index) == 0: return self @@ -2914,7 +2914,7 @@ def last(self, offset): """ from pandas.tseries.frequencies import to_offset if not isinstance(self.index, DatetimeIndex): - raise NotImplementedError + raise NotImplementedError("Currently implemented for DatatimeIndex instance only") if len(self.index) == 0: return self diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py index c2debb9bfe1c0..abba9f352da44 100644 --- a/pandas/core/groupby.py +++ b/pandas/core/groupby.py @@ -283,7 +283,7 @@ def _set_grouper(self, obj, sort=False): return self.grouper def _get_binner_for_grouping(self, obj): - raise NotImplementedError + raise NotImplementedError("Binner for grouping") @property def groups(self): @@ -644,7 +644,7 @@ def _python_apply_general(self, f): not_indexed_same=mutated) def aggregate(self, func, *args, **kwargs): - raise NotImplementedError + raise NotImplementedError("Groupby aggregrate") @Appender(_agg_doc) def agg(self, func, *args, **kwargs): @@ -654,7 +654,7 @@ def _iterate_slices(self): yield self.name, self._selected_obj def transform(self, func, *args, **kwargs): - raise NotImplementedError + raise NotImplementedError("Groupby transform") def mean(self): """ @@ -1041,7 +1041,7 @@ def _python_agg_general(self, func, *args, **kwargs): return self._wrap_aggregated_output(output) def _wrap_applied_output(self, *args, **kwargs): - raise NotImplementedError + raise NotImplementedError("Groupby wrap applied output") def _concat_objects(self, keys, values, not_indexed_same=False): from pandas.tools.merge import concat @@ -1404,7 +1404,7 @@ def aggregate(self, values, how, axis=0): swapped = True values = values.swapaxes(0, axis) if arity > 1: - raise NotImplementedError + raise NotImplementedError("BaseGrouper aggregate for arity > 1") out_shape = (self.ngroups,) + values.shape[1:] if is_numeric_dtype(values.dtype): @@ -1459,7 +1459,7 @@ def _aggregate(self, result, counts, values, how, is_numeric): comp_ids, _, ngroups = self.group_info if values.ndim > 3: # punting for now - raise NotImplementedError + raise NotImplementedError("BaseGrouper aggregrate for > 3 dimensions") elif values.ndim > 2: for i, chunk in enumerate(values.transpose(2, 0, 1)): @@ -1695,7 +1695,7 @@ def _aggregate(self, result, counts, values, how, is_numeric=True): if values.ndim > 3: # punting for now - raise NotImplementedError + raise NotImplementedError("BinGrouper aggregate for > 3 dimensions") elif values.ndim > 2: for i, chunk in enumerate(values.transpose(2, 0, 1)): agg_func(result[:, :, i], counts, chunk, self.bins) @@ -2399,7 +2399,7 @@ def aggregate(self, arg, *args, **kwargs): if self._selection is not None: subset = obj if isinstance(subset, DataFrame): - raise NotImplementedError + raise NotImplementedError("aggregate not implemented for subset being a Dataframe") for fname, agg_how in compat.iteritems(arg): colg = SeriesGroupBy(subset, selection=self._selection, @@ -2459,7 +2459,7 @@ def _aggregate_multiple_funcs(self, arg): from pandas.tools.merge import concat if self.axis != 0: - raise NotImplementedError + raise NotImplementedError("Currently implemented for axis = 0") obj = self._obj_with_exclusions @@ -2509,7 +2509,7 @@ def _aggregate_generic(self, func, *args, **kwargs): return self._wrap_generic_output(result, obj) def _wrap_aggregated_output(self, output, names=None): - raise NotImplementedError + raise NotImplementedError("NDFrameGroupBy wrap aggregated output") def _aggregate_item_by_item(self, func, *args, **kwargs): # only for axis==0 @@ -3050,7 +3050,7 @@ def _iterate_slices(self): slice_axis = self._selection_list slicer = lambda x: self._selected_obj[x] else: - raise NotImplementedError + raise NotImplementedError("Currently implemented for axis = 0") for val in slice_axis: if val in self.exclusions: @@ -3115,10 +3115,10 @@ def _aggregate_item_by_item(self, func, *args, **kwargs): new_axes[self.axis] = self.grouper.result_index return Panel._from_axes(result, new_axes) else: - raise NotImplementedError + raise NotImplementedError("Currently implemented for axis>0") def _wrap_aggregated_output(self, output, names=None): - raise NotImplementedError + raise NotImplementedError("PanelGroupBy _wrap_aggregated_output") class NDArrayGroupBy(GroupBy): @@ -3172,7 +3172,7 @@ def _chop(self, sdata, slice_obj): return sdata.iloc[slice_obj] def apply(self, f): - raise NotImplementedError + raise NotImplementedError("DataSplitter apply function") class ArraySplitter(DataSplitter): diff --git a/pandas/core/indexing.py b/pandas/core/indexing.py index 280c4073b0f94..860422c058d77 100644 --- a/pandas/core/indexing.py +++ b/pandas/core/indexing.py @@ -7,7 +7,7 @@ import pandas.core.common as com from pandas.core.common import (_is_bool_indexer, is_integer_dtype, _asarray_tuplesafe, is_list_like, isnull, - ABCSeries, ABCDataFrame, ABCPanel, is_float) + ABCSeries, ABCDataFrame, ABCPanel, is_float, AbstractMethodError) import pandas.lib as lib import numpy as np @@ -55,7 +55,7 @@ def __call__(self, *args, **kwargs): return self def __iter__(self): - raise NotImplementedError('ix is not iterable') + raise AbstractMethodError('ix is not iterable') def __getitem__(self, key): if type(key) is tuple: @@ -120,7 +120,7 @@ def __setitem__(self, key, value): self._setitem_with_indexer(indexer, value) def _has_valid_type(self, k, axis): - raise NotImplementedError() + raise AbstractMethodError("Valid type checking for _NDFrameIndexer is not implemented") def _has_valid_tuple(self, key): """ check the key for valid keys across my indexer """ @@ -644,7 +644,7 @@ def _align_frame(self, indexer, df): def _align_panel(self, indexer, df): is_frame = self.obj.ndim == 2 is_panel = self.obj.ndim >= 3 - raise NotImplementedError("cannot set using an indexer with a Panel " + raise AbstractMethodError("cannot set using an indexer with a Panel " "yet!") def _getitem_tuple(self, tup): @@ -1141,7 +1141,7 @@ def __getitem__(self, key): return self._getitem_axis(key, axis=0) def _getitem_axis(self, key, axis=0, validate_iterable=False): - raise NotImplementedError() + raise AbstractMethodError("Get item along given axis in _LocationIndexer is not implemented") def _getbool_axis(self, key, axis=0): labels = self.obj._get_axis(axis) @@ -1299,7 +1299,7 @@ def _has_valid_type(self, key, axis): if com._is_bool_indexer(key): if hasattr(key, 'index') and isinstance(key.index, Index): if key.index.inferred_type == 'integer': - raise NotImplementedError( + raise AbstractMethodError( "iLocation based boolean indexing on an integer type " "is not available" ) diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 8100b98d6e42d..884dab11e8808 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -243,7 +243,7 @@ def fillna(self, value, limit=None, inplace=False, downcast=None): mask = isnull(self.values) if limit is not None: if self.ndim > 2: - raise NotImplementedError + raise NotImplementedError("fillna function not implemented for more than 2 dimensions") mask[mask.cumsum(self.ndim-1)>limit]=False value = self._try_fill(value) @@ -363,10 +363,10 @@ def convert(self, copy=True, **kwargs): return [self.copy()] if copy else [self] def _can_hold_element(self, value): - raise NotImplementedError() + raise NotImplementedError("Block _can_hold_element function") def _try_cast(self, value): - raise NotImplementedError() + raise NotImplementedError("Block _try_cast") def _try_cast_result(self, result, dtype=None): """ try to cast the result to our original type, @@ -1519,7 +1519,7 @@ def fillna(self, value, limit=None, value = self._try_fill(value) if limit is not None: if self.ndim > 2: - raise NotImplementedError + raise NotImplementedError("fillna function not implemented for more than 2 dimensions") mask[mask.cumsum(self.ndim-1)>limit]=False np.putmask(values, mask, value) @@ -1741,7 +1741,7 @@ def interpolate(self, method='pad', axis=0, inplace=False, def fillna(self, value, limit=None, inplace=False, downcast=None): # we may need to upcast our fill to match our dtype if limit is not None: - raise NotImplementedError + raise NotImplementedError("fillna currently implemented only for limit=None") if issubclass(self.dtype.type, np.floating): value = float(value) values = self.values if inplace else self.values.copy() diff --git a/pandas/core/panel.py b/pandas/core/panel.py index e9f8893355f2d..1cd867a5233ba 100644 --- a/pandas/core/panel.py +++ b/pandas/core/panel.py @@ -595,10 +595,10 @@ def conform(self, frame, axis='items'): return frame.reindex(**self._extract_axes_for_slice(self, axes)) def head(self, n=5): - raise NotImplementedError + raise NotImplementedError("Returns the head content of a Panel") def tail(self, n=5): - raise NotImplementedError + raise NotImplementedError("Returns the tail content of a Panel") def _needs_reindex_multi(self, axes, method, level): """ don't allow a multi reindex on Panel or above ndim """ diff --git a/pandas/core/panelnd.py b/pandas/core/panelnd.py index 3eebd51190e3d..73ba07f845e87 100644 --- a/pandas/core/panelnd.py +++ b/pandas/core/panelnd.py @@ -99,7 +99,7 @@ def _combine_with_constructor(self, other, func): for f in ['to_frame', 'to_excel', 'to_sparse', 'groupby', 'join', 'filter', 'dropna', 'shift']: def func(self, *args, **kwargs): - raise NotImplementedError + raise NotImplementedError("%s is not implemented" % f) setattr(klass, f, func) # add the aggregate operations diff --git a/pandas/core/series.py b/pandas/core/series.py index 78b049f4bf8d5..2ed3f9c854817 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -156,7 +156,7 @@ def __init__(self, data=None, index=None, dtype=None, name=None, dtype = self._validate_dtype(dtype) if isinstance(data, MultiIndex): - raise NotImplementedError + raise NotImplementedError("Series initialization currently is not implemented for MultiIndex") elif isinstance(data, Index): # need to copy to avoid aliasing issues if name is None: diff --git a/pandas/core/strings.py b/pandas/core/strings.py index ad64d2bf6bdd9..0591131f986b6 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -680,7 +680,7 @@ def str_slice_replace(arr, start=None, stop=None, repl=None): ------- replaced : array """ - raise NotImplementedError + raise NotImplementedError("String slice replace not implemented") def str_strip(arr, to_strip=None): @@ -985,7 +985,7 @@ def slice(self, start=None, stop=None, step=1): @copy(str_slice) def slice_replace(self, i=None, j=None): - raise NotImplementedError + raise NotImplementedError("String slice replace is not implemented.") @copy(str_decode) def decode(self, encoding, errors="strict"): diff --git a/pandas/index.pyx b/pandas/index.pyx index 3dcdbf207fb3f..ab1bea2abb22c 100644 --- a/pandas/index.pyx +++ b/pandas/index.pyx @@ -234,10 +234,10 @@ cdef class IndexEngine: self._ensure_mapping_populated() def _call_monotonic(self, values): - raise NotImplementedError + raise NotImplementedError("IndexEngine _call_monotonic is not implemented") cdef _make_hash_table(self, n): - raise NotImplementedError + raise NotImplementedError("IndexEngine _make_hash_table is not implemented") cdef _check_type(self, object val): hash(val) diff --git a/pandas/io/ga.py b/pandas/io/ga.py index f002994888932..9ee6a64c1affc 100644 --- a/pandas/io/ga.py +++ b/pandas/io/ga.py @@ -240,7 +240,7 @@ def get_profile(self, account_id=None, web_property_id=None, name=None, return _get_match(profiles, name, id, **kwargs) def create_query(self, *args, **kwargs): - raise NotImplementedError() + raise NotImplementedError("Create query in GDataReader is not implemented") @Substitution(extras='') @Appender(_GA_READER_DOC) diff --git a/pandas/io/html.py b/pandas/io/html.py index 5ea6ca36ac764..39da36f84a3aa 100644 --- a/pandas/io/html.py +++ b/pandas/io/html.py @@ -215,7 +215,7 @@ def _text_getter(self, obj): text : str or unicode The text from an individual DOM node. """ - raise NotImplementedError + raise NotImplementedError("Text from an individual DOM node") def _parse_td(self, obj): """Return the td elements from a row element. @@ -229,7 +229,7 @@ def _parse_td(self, obj): columns : list of node-like These are the elements of each row, i.e., the columns. """ - raise NotImplementedError + raise NotImplementedError("Elements of each row, i.e the columns") def _parse_tables(self, doc, match, attrs): """Return all tables from the parsed DOM. @@ -256,7 +256,7 @@ def _parse_tables(self, doc, match, attrs): tables : list of node-like A list of elements to be parsed into raw data. """ - raise NotImplementedError + raise NotImplementedError("All tables from the parsed DOM") def _parse_tr(self, table): """Return the list of row elements from the parsed table element. @@ -271,7 +271,7 @@ def _parse_tr(self, table): rows : list of node-like A list row elements of a table, usually or ... element. """ - raise NotImplementedError + raise NotImplementedError("Header of HTML table") def _parse_tbody(self, table): """Return the body of the table. @@ -301,7 +301,7 @@ def _parse_tbody(self, table): tbody : node-like A ... element. """ - raise NotImplementedError + raise NotImplementedError("Body of HTML table") def _parse_tfoot(self, table): """Return the footer of the table if any. @@ -316,7 +316,7 @@ def _parse_tfoot(self, table): tfoot : node-like A ... element. """ - raise NotImplementedError + raise NotImplementedError("Footer of HTML table") def _build_doc(self): """Return a tree-like object that can be used to iterate over the DOM. @@ -325,7 +325,7 @@ def _build_doc(self): ------- obj : tree-like """ - raise NotImplementedError + raise NotImplementedError("Tree-like object to iterate over the DOM") def _build_table(self, table): header = self._parse_raw_thead(table) diff --git a/pandas/io/json.py b/pandas/io/json.py index 4ed325df9a747..a0d350bf9dfc1 100644 --- a/pandas/io/json.py +++ b/pandas/io/json.py @@ -33,7 +33,7 @@ def to_json(path_or_buf, obj, orient=None, date_format='epoch', double_precision=double_precision, ensure_ascii=force_ascii, date_unit=date_unit, default_handler=default_handler).write() else: - raise NotImplementedError + raise NotImplementedError("to_json is currently implemented for Series and Dataframe only.") if isinstance(path_or_buf, compat.string_types): with open(path_or_buf, 'w') as fh: @@ -64,7 +64,7 @@ def __init__(self, obj, orient, date_format, double_precision, self._format_axes() def _format_axes(self): - raise NotImplementedError + raise NotImplementedError("Writer _format_axes is not implemented") def write(self): return dumps( @@ -282,7 +282,7 @@ def _convert_axes(self): setattr(self.obj, axis, new_axis) def _try_convert_types(self): - raise NotImplementedError + raise NotImplementedError("Try to convert types in Parser is not implemented.") def _try_convert_data(self, name, data, use_dtypes=True, convert_dates=True): @@ -395,7 +395,7 @@ def _try_convert_to_date(self, data): return data, False def _try_convert_dates(self): - raise NotImplementedError + raise NotImplementedError("Try to convert dates in Parser is not implemented") class SeriesParser(Parser): diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 22fe3ef16e34d..9f4fcd863727e 100644 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -679,7 +679,7 @@ def _make_engine(self, engine='c'): self._engine = klass(self.f, **self.options) def _failover_to_python(self): - raise NotImplementedError + raise NotImplementedError("Failover to Python not implemented") def read(self, nrows=None): if nrows is not None: diff --git a/pandas/io/sql.py b/pandas/io/sql.py index bb6f9cee5766e..c22c5b448dd57 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -427,7 +427,7 @@ def to_sql(frame, name, con, flavor='sqlite', if_exists='fail', index=True, if isinstance(frame, Series): frame = frame.to_frame() elif not isinstance(frame, DataFrame): - raise NotImplementedError + raise NotImplementedError("Currently to_sql() implemented only for Series and DataFrame") pandas_sql.to_sql(frame, name, if_exists=if_exists, index=index, index_label=index_label) @@ -983,7 +983,7 @@ def __init__(self, con, flavor, is_cursor=False): if flavor is None: flavor = 'sqlite' if flavor not in ['sqlite', 'mysql']: - raise NotImplementedError + raise NotImplementedError("Currently implemented for sqlite and mysql flavors only") else: self.flavor = flavor diff --git a/pandas/io/tests/test_parsers.py b/pandas/io/tests/test_parsers.py index c02a3172f4adc..feeb1cbee296d 100644 --- a/pandas/io/tests/test_parsers.py +++ b/pandas/io/tests/test_parsers.py @@ -52,10 +52,10 @@ class ParserTests(object): """ def read_csv(self, *args, **kwargs): - raise NotImplementedError + raise NotImplementedError("Read CSV in Parser Tests is not implemented") def read_table(self, *args, **kwargs): - raise NotImplementedError + raise NotImplementedError("Read Table in Parser Tests is not implemented") def setUp(self): import warnings diff --git a/pandas/io/tests/test_sql.py b/pandas/io/tests/test_sql.py index a34f278fc5a96..da88d0fc1203b 100644 --- a/pandas/io/tests/test_sql.py +++ b/pandas/io/tests/test_sql.py @@ -727,10 +727,10 @@ def setup_import(self): raise nose.SkipTest('SQLAlchemy not installed') def setup_driver(self): - raise NotImplementedError() + raise NotImplementedError("SQLAlchemy Setup Driver test not implemented") def connect(self): - raise NotImplementedError() + raise NotImplementedError("SQLAlchemy Connect test not implemented") def setup_connect(self): try: @@ -740,7 +740,7 @@ def setup_connect(self): raise nose.SkipTest("Can't connect to {0} server".format(self.flavor)) def tearDown(self): - raise NotImplementedError() + raise NotImplementedError("SQLAlchemy Tear Down test not implemented") def test_aread_sql(self): self._read_sql_iris() diff --git a/pandas/sparse/frame.py b/pandas/sparse/frame.py index bd34c7e5f02b2..46c952c58ae21 100644 --- a/pandas/sparse/frame.py +++ b/pandas/sparse/frame.py @@ -250,7 +250,7 @@ def to_dense(self): return DataFrame(data, index=self.index) def astype(self, dtype): - raise NotImplementedError + raise NotImplementedError("SparseDataFrame astype not implemented") def copy(self, deep=True): """ @@ -419,7 +419,7 @@ def _combine_frame(self, other, func, fill_value=None, level=None): new_index, new_columns = this.index, this.columns if level is not None: - raise NotImplementedError + raise NotImplementedError("Combine Frames implemented only for level=None.") if self.empty and other.empty: return SparseDataFrame(index=new_index).__finalize__(self) @@ -460,9 +460,9 @@ def _combine_match_index(self, other, func, level=None, fill_value=None): new_data = {} if fill_value is not None: - raise NotImplementedError + raise NotImplementedError("Combine match index implemented for fill_value=None only") if level is not None: - raise NotImplementedError + raise NotImplementedError("Combine match index implemented for level=None only") new_index = self.index.union(other.index) this = self @@ -495,9 +495,10 @@ def _combine_match_columns(self, other, func, level=None, fill_value=None): # possible for this to happen, which is bothersome if fill_value is not None: - raise NotImplementedError + raise NotImplementedError("Combine match columns implemented for fill_value=None only") if level is not None: - raise NotImplementedError + raise NotImplementedError("Combine match columns implemented for level=None only") + new_data = {} @@ -568,10 +569,10 @@ def _reindex_columns(self, columns, copy, level, fill_value, limit=None, raise TypeError('Reindex by level not supported for sparse') if com.notnull(fill_value): - raise NotImplementedError + raise NotImplementedError("Currently reindexing for com.nonnull(fillvalue)=True is not implemented") if limit: - raise NotImplementedError + raise NotImplementedError("Currently limit=None is only implemented") # TODO: fill value handling sdict = dict((k, v) for k, v in compat.iteritems(self) if k in columns) diff --git a/pandas/sparse/list.py b/pandas/sparse/list.py index bfc4ab9d3eb48..c75fbf2ee10fb 100644 --- a/pandas/sparse/list.py +++ b/pandas/sparse/list.py @@ -46,7 +46,7 @@ def __getitem__(self, i): return self._chunks[j][i - passed] def __setitem__(self, i, value): - raise NotImplementedError + raise NotImplementedError("set item in SparseList is not implemented") @property def nchunks(self): diff --git a/pandas/sparse/panel.py b/pandas/sparse/panel.py index 20bbc58cc908f..b1b6889e8823c 100644 --- a/pandas/sparse/panel.py +++ b/pandas/sparse/panel.py @@ -32,7 +32,7 @@ def __set__(self, obj, value): value = _ensure_index(value) if isinstance(value, MultiIndex): - raise NotImplementedError + raise NotImplementedError("Currently Sparse Panel Axis does not support MutliIndex") for v in compat.itervalues(obj._frames): setattr(v, self.frame_attr, value) @@ -155,7 +155,7 @@ def _get_items(self): def _set_items(self, new_items): new_items = _ensure_index(new_items) if isinstance(new_items, MultiIndex): - raise NotImplementedError + raise NotImplementedError("Currently Sparse Panel Axis does not support MutliIndex") # need to create new frames dict diff --git a/pandas/src/generate_code.py b/pandas/src/generate_code.py index b432ddd03d17f..d17b689fb1640 100644 --- a/pandas/src/generate_code.py +++ b/pandas/src/generate_code.py @@ -1619,7 +1619,7 @@ def group_ohlc_%(name)s(ndarray[%(dest_type2)s, ndim=2] out, b = 0 if K > 1: - raise NotImplementedError + raise NotImplementedError("group aggregation for K>1 is not implemented") else: for i in range(N): while b < ngroups - 1 and i >= bins[b]: diff --git a/pandas/src/generated.pyx b/pandas/src/generated.pyx index 42ae043847ba1..6f2feb5c7679d 100644 --- a/pandas/src/generated.pyx +++ b/pandas/src/generated.pyx @@ -6505,7 +6505,7 @@ def group_ohlc_float64(ndarray[float64_t, ndim=2] out, b = 0 if K > 1: - raise NotImplementedError + raise NotImplementedError("group aggregation for K>1 is not implemented") else: for i in range(N): while b < ngroups - 1 and i >= bins[b]: @@ -6578,7 +6578,7 @@ def group_ohlc_float32(ndarray[float32_t, ndim=2] out, b = 0 if K > 1: - raise NotImplementedError + raise NotImplementedError("group aggregation for K>1 is not implemented") else: for i in range(N): while b < ngroups - 1 and i >= bins[b]: diff --git a/pandas/src/sparse.pyx b/pandas/src/sparse.pyx index 579d473cae1b3..6a9855176d20b 100644 --- a/pandas/src/sparse.pyx +++ b/pandas/src/sparse.pyx @@ -27,7 +27,7 @@ cdef class SparseIndex: Abstract superclass for sparse index types ''' def __init__(self): - raise NotImplementedError + raise NotImplementedError("Initialization of Supercall SparseIndex is not implemented") cdef class IntIndex(SparseIndex): @@ -556,7 +556,7 @@ cdef class BlockMerge(object): self.result = self._make_merged_blocks() cdef _make_merged_blocks(self): - raise NotImplementedError + raise NotImplementedError("BlockMerge _make_merged_blocks not implemented") cdef _set_current_indices(self, int32_t xi, int32_t yi, bint mode): if mode == 0: diff --git a/pandas/tools/plotting.py b/pandas/tools/plotting.py index 37a982acc0bbd..5b29fc8a7b7fc 100644 --- a/pandas/tools/plotting.py +++ b/pandas/tools/plotting.py @@ -127,7 +127,7 @@ def random_color(column): colors = lmap(random_color, lrange(num_colors)) else: - raise NotImplementedError + raise NotImplementedError("color_type = default/random are only implemented") if len(colors) != num_colors: multiple = num_colors//len(colors) - 1 @@ -989,7 +989,7 @@ def _compute_plot_data(self): self.data = numeric_data def _make_plot(self): - raise NotImplementedError + raise NotImplementedError("MPLPlot _make_plot not implemented") def _add_table(self): if self.table is False: @@ -1828,7 +1828,7 @@ def f(ax, x, y, w, start=None, log=self.log, **kwds): start = start + self.left return ax.barh(x, y, w, left=start, **kwds) else: - raise NotImplementedError + raise NotImplementedError("Plot with kind = 'bar'/'barh' are only implemented") return f diff --git a/pandas/tseries/index.py b/pandas/tseries/index.py index ff585d80af830..7ed2541af06f7 100644 --- a/pandas/tseries/index.py +++ b/pandas/tseries/index.py @@ -1717,14 +1717,14 @@ def indexer_at_time(self, time, asof=False): from dateutil.parser import parse if asof: - raise NotImplementedError + raise NotImplementedError("Currently selection of values is implemented for asof=False") if isinstance(time, compat.string_types): time = parse(time).time() if time.tzinfo: # TODO - raise NotImplementedError + raise NotImplementedError("Currently datetime.time or string is supported") time_micros = self._get_time_micros() micros = _time_to_micros(time) @@ -1756,7 +1756,7 @@ def indexer_between_time(self, start_time, end_time, include_start=True, end_time = parse(end_time).time() if start_time.tzinfo or end_time.tzinfo: - raise NotImplementedError + raise NotImplementedError("Currently implemented for datetime.time and string") time_micros = self._get_time_micros() start_micros = _time_to_micros(start_time) @@ -1858,7 +1858,7 @@ def _generate_regular_range(start, end, periods, offset): b = e - periods * stride tz = end.tz else: - raise NotImplementedError + raise NotImplementedError("start and end are None, periods is not None is not currently implemented") data = np.arange(b, e, stride, dtype=np.int64) data = DatetimeIndex._simple_new(data, None, tz=tz) diff --git a/pandas/tseries/resample.py b/pandas/tseries/resample.py index 059a6bfd06719..7e52683bca739 100644 --- a/pandas/tseries/resample.py +++ b/pandas/tseries/resample.py @@ -346,11 +346,11 @@ def _take_new_index(obj, indexer, new_index, axis=0): return Series(new_values, index=new_index, name=obj.name) elif isinstance(obj, DataFrame): if axis == 1: - raise NotImplementedError + raise NotImplementedError("Taking new index of a Dataframe not implemented for axis=1") return DataFrame(obj._data.reindex_indexer( new_axis=new_index, indexer=indexer, axis=1)) else: - raise NotImplementedError + raise NotImplementedError("Taking new index implemented only for Series and DataFrame") def _get_range_edges(axis, offset, closed='left', base=0): @@ -429,7 +429,7 @@ def asfreq(obj, freq, method=None, how=None, normalize=False): """ if isinstance(obj.index, PeriodIndex): if method is not None: - raise NotImplementedError + raise NotImplementedError("Currently utility frequency conversion implemented for method=None") if how is None: how = 'E'
elements. """ - raise NotImplementedError + raise NotImplementedError("List of row elements from parsed table element") def _parse_thead(self, table): """Return the header of a table. @@ -286,7 +286,7 @@ def _parse_thead(self, table): thead : node-like A