diff --git a/pandas/core/arrays/_ranges.py b/pandas/core/arrays/_ranges.py index 2cae2c9250ea5..20e4cf70eddcf 100644 --- a/pandas/core/arrays/_ranges.py +++ b/pandas/core/arrays/_ranges.py @@ -179,7 +179,6 @@ def _generate_range_overflow_safe_signed( # watch out for very special case in which we just slightly # exceed implementation bounds, but when passing the result to # np.arange will get a result slightly within the bounds - assert endpoint >= 0 result = np.uint64(endpoint) + np.uint64(addend) i64max = np.uint64(np.iinfo(np.int64).max) assert result > i64max diff --git a/pandas/core/base.py b/pandas/core/base.py index 88b8fe405c8e4..c900a0ba722c0 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -309,7 +309,6 @@ def _aggregate(self, arg, *args, **kwargs): None if not required """ is_aggregator = lambda x: isinstance(x, (list, tuple, dict)) - is_nested_renamer = False _axis = kwargs.pop("_axis", None) if _axis is None: @@ -398,24 +397,7 @@ def _agg(arg, func): keys = list(arg.keys()) result = OrderedDict() - # nested renamer - if is_nested_renamer: - result = list(_agg(arg, _agg_1dim).values()) - - if all(isinstance(r, dict) for r in result): - - result, results = OrderedDict(), result - for r in results: - result.update(r) - keys = list(result.keys()) - - else: - - if self._selection is not None: - keys = None - - # some selection on the object - elif self._selection is not None: + if self._selection is not None: sl = set(self._selection_list) diff --git a/pandas/core/groupby/generic.py b/pandas/core/groupby/generic.py index ec183fcfc154a..bfe3c628169e9 100644 --- a/pandas/core/groupby/generic.py +++ b/pandas/core/groupby/generic.py @@ -1131,7 +1131,6 @@ def _aggregate_item_by_item(self, func, *args, **kwargs) -> DataFrame: obj = self._obj_with_exclusions result: OrderedDict = OrderedDict() cannot_agg = [] - errors = None for item in obj: data = obj[item] colg = SeriesGroupBy(data, selection=item, grouper=self.grouper) @@ -1157,10 +1156,6 @@ def _aggregate_item_by_item(self, func, *args, **kwargs) -> DataFrame: if cannot_agg: result_columns = result_columns.drop(cannot_agg) - # GH6337 - if not len(result_columns) and errors is not None: - raise errors - return DataFrame(result, columns=result_columns) def _wrap_applied_output(self, keys, values, not_indexed_same=False): diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 7b0cc871cbcbc..4c665ad596eb1 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -2204,9 +2204,6 @@ def reorder_levels(self, order): levels=new_levels, codes=new_codes, names=new_names, verify_integrity=False ) - def __getslice__(self, i, j): - return self.__getitem__(slice(i, j)) - def _get_codes_for_sorting(self): """ we categorizing our codes by using the diff --git a/pandas/core/internals/concat.py b/pandas/core/internals/concat.py index 7cb693474c82f..c6f30ef65e9d5 100644 --- a/pandas/core/internals/concat.py +++ b/pandas/core/internals/concat.py @@ -195,7 +195,6 @@ def get_reindexed_values(self, empty_dtype, upcasted_na): return array( np.full(self.shape[1], fill_value.value), dtype=empty_dtype ) - pass elif getattr(self.block, "is_categorical", False): pass elif getattr(self.block, "is_extension", False): diff --git a/pandas/core/ops/missing.py b/pandas/core/ops/missing.py index 3bb7bb022dd3a..96a615d488bf2 100644 --- a/pandas/core/ops/missing.py +++ b/pandas/core/ops/missing.py @@ -168,7 +168,7 @@ def dispatch_fill_zeros(op, left, right, result): # Note: no need to do this for truediv; in py3 numpy behaves the way # we want. result = mask_zero_div_zero(left, right, result) - elif op is op is rfloordiv: + elif op is rfloordiv: # Note: no need to do this for rtruediv; in py3 numpy behaves the way # we want. result = mask_zero_div_zero(right, left, result) diff --git a/pandas/plotting/_matplotlib/converter.py b/pandas/plotting/_matplotlib/converter.py index feb895a099da5..5386c222f7bfb 100644 --- a/pandas/plotting/_matplotlib/converter.py +++ b/pandas/plotting/_matplotlib/converter.py @@ -387,12 +387,12 @@ def __call__(self): except ValueError: return [] - if dmin > dmax: - dmax, dmin = dmin, dmax # We need to cap at the endpoints of valid datetime # FIXME: dont leave commented-out # TODO(wesm) unused? + # if dmin > dmax: + # dmax, dmin = dmin, dmax # delta = relativedelta(dmax, dmin) # try: # start = dmin - delta diff --git a/scripts/validate_docstrings.py b/scripts/validate_docstrings.py index 7c6f2fea97933..b0eeb7b96e0eb 100755 --- a/scripts/validate_docstrings.py +++ b/scripts/validate_docstrings.py @@ -965,7 +965,7 @@ def header(title, width=80, char="#"): "]{text}\n" ) else: - raise ValueError('Unknown output_format "{}"'.format(output_format)) + raise ValueError(f'Unknown output_format "{output_format}"') output = "" for name, res in result.items(): @@ -977,11 +977,10 @@ def header(title, width=80, char="#"): continue exit_status += 1 output += output_format.format( - name=name, path=res["file"], row=res["file_line"], code=err_code, - text="{}: {}".format(name, err_desc), + text=f"{name}: {err_desc}", ) sys.stdout.write(output)