Skip to content
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

TYP/COMPAT: don't use Literal for Series.ndim to avoid tab completion bug in IPython #60197

Merged
Merged
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
TYP/COMPAT: don't use Literal for Series.ndim to avoid tab completion…
… bug in IPython
  • Loading branch information
jorisvandenbossche committed Nov 5, 2024
commit 4d7cf9e64383f8fa6000492a7bdb6e97d2626926
5 changes: 4 additions & 1 deletion pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,11 @@ def __len__(self) -> int:
# We need this defined here for mypy
raise AbstractMethodError(self)

# Temporarily avoid using `-> Literal[1]:` because of an IPython (jedi) bug
# https://github.com/ipython/ipython/issues/14412
# https://github.com/davidhalter/jedi/issues/1990
@property
def ndim(self) -> Literal[1]:
def ndim(self) -> int:
"""
Number of dimensions of the underlying data, by definition 1.

Expand Down
Loading