blob: af6e00bad7f6b6a7d26efb2a700917a40bc607a6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# -*- coding: utf-8 -*-
cdef class _NDFrameIndexerBase:
"""
A base class for _NDFrameIndexer for fast instantiation and attribute
access.
"""
cdef public object obj, name, _ndim
def __init__(self, name, obj):
self.obj = obj
self.name = name
self._ndim = None
@property
def ndim(self):
# Delay `ndim` instantiation until required as reading it
# from `obj` isn't entirely cheap.
ndim = self._ndim
if ndim is None:
ndim = self._ndim = self.obj.ndim
return ndim
|