Feature request: support for static frames
Closed this issue · 1 comments
nicolas-graves commented
The static-frames python package works like pandas but enforces immutability on its frames, which would benefit greatly from an integration with data_cache (in the hypothesis of a functional data analysis approach).
https://static-frame.readthedocs.io/en/latest/index.html
Fransisnk commented
Hey! I think this is a bit out of scope for this project due to the current adaptation of static-frame however it should not be too hard to create your own store function like:
data_cache/data_cache/cache_tools.py
Lines 137 to 179 in cd76456
data_cache
and for example to_hdf5/from_hdf5 in static-frame in order to achieve the results you want.
something like:
def static_frames_store(
func_key: str,
arg_key: str,
func: cache_able_function,
f_args: Tuple[Any],
f_kwargs: Dict[str, Any],
metadata: Dict[str, str] = None,
):
file_path = data_cache.get_path() / "static-frames.h5"
path = f"/{func_key}/{arg_key}"
# Try to return data with from_hdf5
data = func(*f_args, **f_kwargs)
# Store data with to_hdf5
return data
And then create your decorator:
static_frames_cache = cache_decorator_factory(static_frames_store)
@static_frames_cache
def your_function():
...