Skip to content

Commit 3ebd719

Browse files
jhelieKiv
authored andcommitted
Fix some lgtm alerts (pandas-dev#16613)
1 parent 93aabe7 commit 3ebd719

File tree

7 files changed

+9
-13
lines changed

7 files changed

+9
-13
lines changed

pandas/core/dtypes/cast.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ def maybe_convert_objects(values, convert_dates=True, convert_numeric=True,
668668

669669
if convert_timedeltas == 'coerce':
670670
from pandas.core.tools.timedeltas import to_timedelta
671-
new_values = to_timedelta(values, coerce=True)
671+
new_values = to_timedelta(values, errors='coerce')
672672

673673
# if we are all nans then leave me alone
674674
if not isnull(new_values).all():

pandas/core/generic.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4285,7 +4285,7 @@ def asof(self, where, subset=None):
42854285
raise ValueError("subset is not valid for Series")
42864286
elif self.ndim > 2:
42874287
raise NotImplementedError("asof is not implemented "
4288-
"for {type}".format(type(self)))
4288+
"for {type}".format(type=type(self)))
42894289
else:
42904290
if subset is None:
42914291
subset = self.columns
@@ -4980,7 +4980,7 @@ def last(self, offset):
49804980

49814981
offset = to_offset(offset)
49824982

4983-
start_date = start = self.index[-1] - offset
4983+
start_date = self.index[-1] - offset
49844984
start = self.index.searchsorted(start_date, side='right')
49854985
return self.iloc[start:]
49864986

@@ -5303,8 +5303,8 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
53035303

53045304
# slice me out of the other
53055305
else:
5306-
raise NotImplemented("cannot align with a higher dimensional "
5307-
"NDFrame")
5306+
raise NotImplementedError("cannot align with a higher "
5307+
"dimensional NDFrame")
53085308

53095309
elif is_list_like(other):
53105310

pandas/core/indexes/interval.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1053,11 +1053,11 @@ def interval_range(start=None, end=None, freq=None, periods=None,
10531053
if periods is None or end is None:
10541054
raise ValueError("must specify 2 of start, end, periods")
10551055
start = end - periods * freq
1056-
elif end is None:
1056+
if end is None:
10571057
if periods is None or start is None:
10581058
raise ValueError("must specify 2 of start, end, periods")
10591059
end = start + periods * freq
1060-
elif periods is None:
1060+
if periods is None:
10611061
if start is None or end is None:
10621062
raise ValueError("must specify 2 of start, end, periods")
10631063
pass

pandas/core/internals.py

-3
Original file line numberDiff line numberDiff line change
@@ -4645,7 +4645,6 @@ def _block2d_to_blocknd(values, placement, shape, labels, ref_items):
46454645
pvalues = np.empty(panel_shape, dtype=dtype)
46464646
pvalues.fill(fill_value)
46474647

4648-
values = values
46494648
for i in range(len(placement)):
46504649
pvalues[i].flat[mask] = values[:, i]
46514650

@@ -5154,8 +5153,6 @@ def dtype(self):
51545153
return _get_dtype(maybe_promote(self.block.dtype,
51555154
self.block.fill_value)[0])
51565155

5157-
return self._dtype
5158-
51595156
@cache_readonly
51605157
def is_null(self):
51615158
if self.block is None:

pandas/core/sparse/array.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def _sparse_array_op(left, right, op, name, series=False):
125125
name = name[1:]
126126

127127
if name in ('and', 'or') and dtype == 'bool':
128-
opname = 'sparse_{name}_uint8'.format(name=name, dtype=dtype)
128+
opname = 'sparse_{name}_uint8'.format(name=name)
129129
# to make template simple, cast here
130130
left_sp_values = left.sp_values.view(np.uint8)
131131
right_sp_values = right.sp_values.view(np.uint8)

pandas/io/parsers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,7 @@ def _exclude_implicit_index(self, alldata):
22112211
def get_chunk(self, size=None):
22122212
if size is None:
22132213
size = self.chunksize
2214-
return self.read(nrows=size)
2214+
return self.read(rows=size)
22152215

22162216
def _convert_data(self, data):
22172217
# apply converters

pandas/tseries/offsets.py

-1
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,6 @@ def apply(self, other):
15961596
if otherDay != self.weekday:
15971597
other = other + timedelta((self.weekday - otherDay) % 7)
15981598
k = k - 1
1599-
other = other
16001599
for i in range(k):
16011600
other = other + self._inc
16021601
else:

0 commit comments

Comments
 (0)