Save and load vars, functions, objects ...
How to save the global vars (or any other variable)
# Create a file
import pandas as pd
from save_load_vars import save_vars_pkl
df = pd.read_csv(
"https://raw.githubusercontent.com/pandas-dev/pandas/main/doc/data/titanic.csv"
)
def myfunction(x):
return str(x) + "bbbb"
myfunction2 = lambda k: myfunction(k)
partofframe = df.Name.copy()[:50]
# Save the global vars
save_vars_pkl(g=globals(), folder=f"f:\\pklsavetest", interface="dill", protocol=None)
How to load the saved data
from save_load_vars import load_vars_pkl
load_vars_pkl(folder=f'f:\\pklsavetest',
name=__name__,interface='dill')
print(df)
print(myfunction(44))
print(partofframe)
print(df.Cabin.apply(myfunction2))
How to create global variables from a dict
from save_load_vars import globals_from_dict
didi={
'a':'bobo',
'b':'bobao',
'c': [4,3,3]
}
globals_from_dict(didi,__name__)
print(a)
print(b)
print(c)
Metadata
Release files for save-load-vars 0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| save_load_vars-0.11.tar.gz | 4.3 kB | Without provenance | Details for save_load_vars-0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| save_load_vars-0.11-py3-none-any.whl | Python 3 | none | any | Details for save_load_vars-0.11-py3-none-any.whl |
Total release size: 10.1 kB
Release files / save_load_vars-0.11.tar.gz
| Download URL | save_load_vars-0.11.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bcfb8dae2c660dd080c054727e694e81e2773bb76ae8492a78991ccb8464afe4
|
|
BLAKE2b-256 checksum How to use checksums |
6d1209254651dc0a963ba6cc0bd34e9141e78bef4b60d52486f0ec2e592432d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / save_load_vars-0.11-py3-none-any.whl
| Download URL | save_load_vars-0.11-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ce80d5fd3ef27d0161c7d5abc74317da80d9efdede690ad04a5a3f3878a2115
|
|
BLAKE2b-256 checksum How to use checksums |
e33dc1bfc110128cc45cc4118a969de631ab7d3006347672f16964bfb8c6c75a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for save-load-vars 0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.