microsoft/qlib · error · NotImplementedError
Subclass of FeatureStorage must implement `__getitem__(s: sl
Error message
Subclass of FeatureStorage must implement `__getitem__(s: slice)` method
What it means
Error "Subclass of FeatureStorage must implement `__getitem__(s: slice)` method" thrown in microsoft/qlib.
Source
Thrown at qlib/data/storage/storage.py:70
class UserFeatureStorage(FeatureStorage):
def __getitem__(self, s: slice) -> pd.Series:
'''x.__getitem__(slice(start: int, stop: int, step: int)) <==> x[start:stop:step]
Returns
-------
pd.Series(values, index=pd.RangeIndex(start, len(values))
Notes
-------
if data(storage) does not exist:
if isinstance(i, int):
return (None, None)
if isinstance(i, slice):
# return empty pd.Series
return pd.Series(dtype=np.float32)
'''
raise NotImplementedError(
"Subclass of FeatureStorage must implement `__getitem__(s: slice)` method"
)
"""
class BaseStorage:
@property
def storage_name(self) -> str:
return re.findall("[A-Z][^A-Z]*", self.__class__.__name__)[-2].lower()
class CalendarStorage(BaseStorage):
"""
The behavior of CalendarStorage's methods and List's methods of the same name remain consistent
"""
View on GitHub (pinned to 79633dd950)
Solutions
- Implement `__getitem__(s: slice)` in your FeatureStorage subclass.
- Use the built-in FileFeatureStorage which implements `__getitem__`.
When it happens
Trigger: This error is raised at qlib/data/storage/storage.py:70 when the guard condition fails: "Subclass of FeatureStorage must implement `__getitem__(s: slice)` method". It triggers when the code path receives input or a state that violates the precondition checked at this point — e.g. an unimplemented abstract method being called, an unsupported argument type/value, or an invalid configuration. To avoid it, satisfy the documented precondition before this call: implement the required method in your subclass, or pass a supported value of the expected type as described by the message.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15).
Data as JSON: /api/errors/7aa3c27ff8752a13.
Report an issue: GitHub.