Skip to content

Commit

Permalink
Fix some lgtm alerts (pandas-dev#16613)
Browse files Browse the repository at this point in the history
  • Loading branch information
jhelie authored and jreback committed Jun 7, 2017
1 parent 697d026 commit 10c17d4
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:]

Expand Down Expand Up @@ -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):

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/sparse/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion pandas/tseries/offsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 10c17d4

Please sign in to comment.