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
3 changes: 2 additions & 1 deletion pandas/core/groupby/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
FrozenSet,
Hashable,
Iterable,
Optional,
Sequence,
Tuple,
Type,
Expand Down Expand Up @@ -926,7 +927,7 @@ def aggregate(self, func=None, *args, **kwargs):

agg = aggregate

def _iterate_slices(self) -> Iterable[Tuple[Hashable, Series]]:
def _iterate_slices(self) -> Iterable[Tuple[Optional[Hashable], Series]]:
Copy link
Member

Choose a reason for hiding this comment

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

note there is a similar definition for SeriesGroupBy - not sure if that needs to change as well

Copy link
Member Author

Choose a reason for hiding this comment

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

maybe IndexLabel = Optional[Hashable] in _typing.py

obj = self._selected_obj
if self.axis == 1:
obj = obj.T
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 @@ -745,7 +745,7 @@ def _python_apply_general(self, f):
keys, values, not_indexed_same=mutated or self.mutated
)

def _iterate_slices(self) -> Iterable[Tuple[Hashable, Series]]:
def _iterate_slices(self) -> Iterable[Tuple[Optional[Hashable], Series]]:
raise AbstractMethodError(self)

def transform(self, func, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from io import StringIO
from shutil import get_terminal_size
from textwrap import dedent
from typing import Any, Callable, Hashable, List
from typing import Any, Callable, Hashable, List, Optional
import warnings

import numpy as np
Expand Down Expand Up @@ -472,7 +472,7 @@ def dtypes(self):
return self._data.dtype

@property
def name(self) -> Hashable:
def name(self) -> Optional[Hashable]:
return self.attrs.get("name", None)

@name.setter
Expand Down