A Python package keeping the values of variables between separate runs in a seamless and effortless way.
Project description
keepvariable
A Python package keeping the values of variables between separate runs in a seamless and effortless way.
Installation
Use the package manager pip to install keepvariable.
pip install keepvariable
Usage with Redis
import keepvariable_core as kv
import pandas as pd
kv_redis=kv.KeepVariableRedisServer(host="127.0.0.1",port=6379)
kv_redis.set("test","abc123")
result=kv_redis.get("test")
print(result)
#abc123
#even pandas dataframes, and numpy arrays can be stored
df=pd.DataFrame([[1,2,3,4],[4,5,6,7]],columns=["a","b","c","d"])
array=df.values
kv_redis.set("test_df",df)
result=kv_redis.get("test_df")
print(result)
# a b c d
#0 1 2 3 4
#1 4 5 6 7
kv_redis.set("test_array",array)
result=kv_redis.get("test_array")
print(result)
# #[[1 2 3 4]
# # [4 5 6 7]]
Usage (locally)
from keepvariable_core import Var,kept_variables,save_variables,load_variable
a=Var("b")
b=Var("c")
c=a+b
print(c)
dict1=Var({1,2,3,4,5})
list1=Var(a)
print(kept_variables)
save_variables(kept_variables)
list1=load_variable()
b=load_variable()
c=Var(c)
print(list1)
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
License
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
keepvariable-1.2.13.tar.gz
(13.3 kB
view hashes)
Built Distribution
Close
Hashes for keepvariable-1.2.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0334e90ff8c6fe012d81592e8180a4ad6f5c316239139833db293478d97545b |
|
MD5 | e85a0307db42f127d1d98343b71cd8e6 |
|
BLAKE2b-256 | 5a460b7e1aa481a59cb62411dafacdb452296c4d563d55470b5c475921c56f15 |