Feather Helper is a concise interface to cache numpy arrays and pandas dataframes.
Project description
Feather Helper
Feather Helper is a concise interface to cache and load numpy arrays and pandas dataframes. I use it with Pandoctools/Knitty.
Contents
Install
Via conda (should be "pip>=10.0.1"):
conda install -c defaults -c conda-forge numpy pandas "feather-format>=0.4.0" "pyarrow>=0.11.1" pip install featherhelper
Via pip:
pip install featherhelper
Usage example
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:
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)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
featherhelper-0.0.4.tar.gz
(19.7 kB
view details)
File details
Details for the file featherhelper-0.0.4.tar.gz
.
File metadata
- Download URL: featherhelper-0.0.4.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4feb1cb78866ad62bf814816863ce3d3875b77404c0347a7e7bb6d25440b7353 |
|
MD5 | eb46c0addde9690e38c66677224c7bb0 |
|
BLAKE2b-256 | 90aeac841d7e95eec1973ed17420a32e5da05b93c0cc0a668faa764b57ed7855 |