diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index fd61813a57c98..16b0a5c8a74ca 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -668,7 +668,7 @@ def maybe_convert_objects(values, convert_dates=True, convert_numeric=True, if convert_timedeltas == 'coerce': from pandas.core.tools.timedeltas import to_timedelta - new_values = to_timedelta(values, coerce=True) + new_values = to_timedelta(values, errors='coerce') # if we are all nans then leave me alone if not isnull(new_values).all(): diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 98999ec267c82..accb7d0db1d2c 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4285,7 +4285,7 @@ def asof(self, where, subset=None): raise ValueError("subset is not valid for Series") elif self.ndim > 2: raise NotImplementedError("asof is not implemented " - "for {type}".format(type(self))) + "for {type}".format(type=type(self))) else: if subset is None: subset = self.columns @@ -4980,7 +4980,7 @@ def last(self, offset): offset = to_offset(offset) - start_date = start = self.index[-1] - offset + start_date = self.index[-1] - offset start = self.index.searchsorted(start_date, side='right') return self.iloc[start:] @@ -5303,8 +5303,8 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None, # slice me out of the other else: - raise NotImplemented("cannot align with a higher dimensional " - "NDFrame") + raise NotImplementedError("cannot align with a higher " + "dimensional NDFrame") elif is_list_like(other): diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index b1523cd6c0d0c..e6b2bc0953680 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -1053,11 +1053,11 @@ def interval_range(start=None, end=None, freq=None, periods=None, if periods is None or end is None: raise ValueError("must specify 2 of start, end, periods") start = end - periods * freq - elif end is None: + if end is None: if periods is None or start is None: raise ValueError("must specify 2 of start, end, periods") end = start + periods * freq - elif periods is None: + if periods is None: if start is None or end is None: raise ValueError("must specify 2 of start, end, periods") pass diff --git a/pandas/core/internals.py b/pandas/core/internals.py index 15851a17274ca..58690ad632152 100644 --- a/pandas/core/internals.py +++ b/pandas/core/internals.py @@ -4645,7 +4645,6 @@ def _block2d_to_blocknd(values, placement, shape, labels, ref_items): pvalues = np.empty(panel_shape, dtype=dtype) pvalues.fill(fill_value) - values = values for i in range(len(placement)): pvalues[i].flat[mask] = values[:, i] @@ -5154,8 +5153,6 @@ def dtype(self): return _get_dtype(maybe_promote(self.block.dtype, self.block.fill_value)[0]) - return self._dtype - @cache_readonly def is_null(self): if self.block is None: diff --git a/pandas/core/sparse/array.py b/pandas/core/sparse/array.py index 8ac9d3916573e..c75de01b98e4e 100644 --- a/pandas/core/sparse/array.py +++ b/pandas/core/sparse/array.py @@ -125,7 +125,7 @@ def _sparse_array_op(left, right, op, name, series=False): name = name[1:] if name in ('and', 'or') and dtype == 'bool': - opname = 'sparse_{name}_uint8'.format(name=name, dtype=dtype) + opname = 'sparse_{name}_uint8'.format(name=name) # to make template simple, cast here left_sp_values = left.sp_values.view(np.uint8) right_sp_values = right.sp_values.view(np.uint8) diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 055d6d045d2f2..c2d5a629b03a3 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -2211,7 +2211,7 @@ def _exclude_implicit_index(self, alldata): def get_chunk(self, size=None): if size is None: size = self.chunksize - return self.read(nrows=size) + return self.read(rows=size) def _convert_data(self, data): # apply converters diff --git a/pandas/tseries/offsets.py b/pandas/tseries/offsets.py index f9f4adc1b2c81..2a120a0696836 100644 --- a/pandas/tseries/offsets.py +++ b/pandas/tseries/offsets.py @@ -1596,7 +1596,6 @@ def apply(self, other): if otherDay != self.weekday: other = other + timedelta((self.weekday - otherDay) % 7) k = k - 1 - other = other for i in range(k): other = other + self._inc else: