Skip to content

CLN: Unused varables pt2 #22115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,6 @@ def _format_data(self):
summary = '[{head} ... {tail}]'.format(
head=', '.join(head), tail=', '.join(tail))
else:
head = []
tail = [formatter(x) for x in self]
summary = '[{tail}]'.format(tail=', '.join(tail))

Expand Down
1 change: 0 additions & 1 deletion pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ def _hash_categories(categories, ordered=True):
# everything to a str first, which means we treat
# {'1', '2'} the same as {'1', 2}
# find a better solution
cat_array = np.array([hash(x) for x in categories])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iirc this is a check that the categories can be hashed but i think we now check this on construction

hashed = hash((tuple(categories), ordered))
return hashed
cat_array = hash_array(np.asarray(categories), categorize=False)
Expand Down
1 change: 0 additions & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ def _cython_agg_blocks(self, how, alt=None, numeric_only=True,
obj = self.obj[data.items[locs]]
s = groupby(obj, self.grouper)
result = s.aggregate(lambda x: alt(x, axis=self.axis))
newb = result._data.blocks[0]

finally:

Expand Down
6 changes: 3 additions & 3 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1647,11 +1647,11 @@ def is_int(v):
# if we are mixed and have integers
try:
if is_positional and self.is_mixed():
# TODO: i, j are not used anywhere
# Validate start & stop
if start is not None:
i = self.get_loc(start) # noqa
self.get_loc(start)
if stop is not None:
j = self.get_loc(stop) # noqa
self.get_loc(stop)
is_positional = False
except KeyError:
if self.inferred_type == 'mixed-integer-float':
Expand Down
8 changes: 0 additions & 8 deletions pandas/core/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,6 @@ def _align_frame(self, indexer, df):

if isinstance(indexer, tuple):

aligners = [not com.is_null_slice(idx) for idx in indexer]
sum_aligners = sum(aligners)
# TODO: single_aligner is not used
single_aligner = sum_aligners == 1 # noqa

idx, cols = None, None
sindexers = []
for i, ix in enumerate(indexer):
Expand Down Expand Up @@ -865,9 +860,6 @@ def _align_frame(self, indexer, df):
raise ValueError('Incompatible indexer with DataFrame')

def _align_panel(self, indexer, df):
# TODO: is_frame, is_panel are unused
is_frame = self.obj.ndim == 2 # noqa
is_panel = self.obj.ndim >= 3 # noqa
raise NotImplementedError("cannot set using an indexer with a Panel "
"yet!")

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -1789,7 +1789,7 @@ def na_op(x, y):
def f(self, other, axis=None):
# Validate the axis parameter
if axis is not None:
axis = self._get_axis_number(axis)
self._get_axis_number(axis)

if isinstance(other, self._constructor):
return self._compare_constructor(other, na_op, try_cast=False)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def _getitem_multilevel(self, key):
if isinstance(loc, (slice, np.ndarray)):
new_index = info[loc]
result_index = maybe_droplevels(new_index, key)
slices = [loc] + [slice(None) for x in range(self._AXIS_LEN - 1)]
slices = [loc] + [slice(None)] * (self._AXIS_LEN - 1)
new_values = self.values[slices]

d = self._construct_axes_dict(self._AXIS_ORDERS[1:])
Expand Down
6 changes: 4 additions & 2 deletions pandas/core/sparse/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,8 +624,9 @@ def cumsum(self, axis=0, *args, **kwargs):
cumsum : SparseSeries
"""
nv.validate_cumsum(args, kwargs)
# Validate axis
if axis is not None:
axis = self._get_axis_number(axis)
self._get_axis_number(axis)

new_array = self.values.cumsum()

Expand Down Expand Up @@ -654,7 +655,8 @@ def dropna(self, axis=0, inplace=False, **kwargs):
Analogous to Series.dropna. If fill_value=NaN, returns a dense Series
"""
# TODO: make more efficient
axis = self._get_axis_number(axis or 0)
# Validate axis
self._get_axis_number(axis or 0)
dense_valid = self.to_dense().dropna()
if inplace:
raise NotImplementedError("Cannot perform inplace dropna"
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ def _parse_cell(cell_contents, cell_typ):
if header is not None:
if is_list_like(header):
header_names = []
control_row = [True for x in data[0]]
control_row = [True] * len(data[0])
for row in header:
if is_integer(skiprows):
row += skiprows
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ def get_level_lengths(levels, sentinel=''):
if len(levels) == 0:
return []

control = [True for x in levels[0]]
control = [True] * len(levels[0])

result = []
for level in levels:
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/formats/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ def _write_regular_rows(self, fmt_values, indent):
for i in range(nrows):

if truncate_v and i == (self.fmt.tr_row_num):
str_sep_row = ['...' for ele in row]
str_sep_row = ['...'] * len(row)
self.write_tr(str_sep_row, indent, self.indent_delta,
tags=None, nindex_levels=1)

Expand Down