Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kiwi0fruit/featherhelper
Concise interface to cache numpy arrays and pandas dataframes
https://github.com/kiwi0fruit/featherhelper
cache numpy pandas pyarrow python
Last synced: about 1 month ago
JSON representation
Concise interface to cache numpy arrays and pandas dataframes
- Host: GitHub
- URL: https://github.com/kiwi0fruit/featherhelper
- Owner: kiwi0fruit
- License: mit
- Created: 2018-12-12T08:49:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-01-22T08:50:13.000Z (almost 6 years ago)
- Last Synced: 2024-10-19T02:00:00.439Z (2 months ago)
- Topics: cache, numpy, pandas, pyarrow, python
- Language: Python
- Homepage:
- Size: 47.9 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Feather Helper
Feather Helper is a concise interface to cache and load numpy arrays and pandas dataframes. I use it with [Pandoctools/Knitty](https://github.com/kiwi0fruit/pandoctools).
# Contents
* [Feather Helper](#feather-helper)
* [Contents](#contents)
* [Install](#install)
* [Usage example](#usage-example)# Install
Via conda:
```
conda install -c defaults -c conda-forge featherhelper
```Via pip:
```
pip install featherhelper
```## Usage example
```py
import pandas as pd
import numpy as np
import featherhelper as fh
fh.setdir("~/feather/mydoc") # (optional)
# fh.exc(1, 2) # force raise exceptions for names (optional)# %%
fh.name(1) # can also be fh.name('id1'), default is 'default', 1 is the same as '1'
try:
# raise fh.Err # (optional)
df, A, B = fh.pull() # control length can be set: fh.pull(N)
except fh.Err:
# calculate:
print('push')
df = pd.DataFrame(np.random.random(16).reshape(4, 4))
A = df.values
B = np.random.random(16 * 3).reshape(4, 2, 2, 3)
#
fh.push(df, A, B)print(df, '\n', A, '\n', B)
```A shorter example:
```py
import numpy as np
import featherhelper as fh
# fh.exc()# %%
try:
A = fh.pull()
except fh.Err:
A = np.random.random(16).reshape(4, 4)
fh.push(A)
```