Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address review and fix test
  • Loading branch information
Matt Roeschke committed Feb 8, 2019
commit 311e3b2ae2bc530915a44d6184c19246dfdc866c
3 changes: 1 addition & 2 deletions pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -2167,8 +2167,7 @@ def _reverse_indexer(self):
r, counts = libalgos.groupsort_indexer(self.codes.astype('int64'),
categories.size)
counts = counts.cumsum()
result = (r[counts[indexer]:counts[indexer + 1]]
for indexer in range(len(counts) - 1))
result = (r[start:end] for start, end in zip(counts, counts[1:]))
result = dict(zip(categories, result))
return result

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ def cmp_method(self, other):
else:
mask = self._mask | mask

result[mask] = True if op_name == 'ne' else False
result[mask] = op_name == 'ne'
return result

name = '__{name}__'.format(name=op.__name__)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8576,7 +8576,7 @@ def _where(self, cond, other=np.nan, inplace=False, axis=None, level=None,
cond = self._constructor(cond, **self._construct_axes_dict())

# make sure we are boolean
fill_value = True if inplace else False
fill_value = bool(inplace)
cond = cond.fillna(fill_value)

msg = "Boolean array expected for the condition, not {dtype}"
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/groupby/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ def get_converter(s):
" with multiple grouping keys")
raise ValueError(msg)

converters = (get_converter(s) for s in index_sample)
converters = [get_converter(s) for s in index_sample]
names = (tuple(f(n) for f, n in zip(converters, name))
for name in names)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1872,7 +1872,7 @@ def _wrap_result(self, result, use_codes=True,

if expand is None:
# infer from ndim if expand is not specified
expand = False if result.ndim == 1 else True
expand = result.ndim != 1

elif expand is True and not isinstance(self._orig, Index):
# required when expand=True is explicitly specified
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/arrays/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def _compare_other(self, data, op_name, other):
expected = pd.Series(op(data._data, other))

# fill the nan locations
expected[data._mask] = True if op_name == '__ne__' else False
expected[data._mask] = op_name == '__ne__'

tm.assert_series_equal(result, expected)

Expand All @@ -351,7 +351,7 @@ def _compare_other(self, data, op_name, other):
expected = op(expected, other)

# fill the nan locations
expected[data._mask] = True if op_name == '__ne__' else False
expected[data._mask] = op_name == '__ne__'

tm.assert_series_equal(result, expected)

Expand Down