virtuelle Umgebung teil20b

This commit is contained in:
Olli Graf
2023-09-01 16:01:37 +02:00
parent c9aee44812
commit c04c88e2af
7025 changed files with 1325157 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
cdef class NDFrameIndexerBase:
"""
A base class for _NDFrameIndexer for fast instantiation and attribute access.
"""
cdef:
Py_ssize_t _ndim
cdef public:
str name
object obj
def __init__(self, name: str, obj):
self.obj = obj
self.name = name
self._ndim = -1
@property
def ndim(self) -> int:
# Delay `ndim` instantiation until required as reading it
# from `obj` isn't entirely cheap.
ndim = self._ndim
if ndim == -1:
ndim = self._ndim = self.obj.ndim
if ndim > 2:
raise ValueError( # pragma: no cover
"NDFrameIndexer does not support NDFrame objects with ndim > 2"
)
return ndim