A tool for encryption and decryption of pandas dataframes.
Project description
CryptPandas ![](https://pypi-camo.freetls.fastly.net/6cfdc7acb19b10bb2ac7275902d93a1b3fbdb43c/68747470733a2f2f7261772e67697468756275736572636f6e74656e742e636f6d2f4c7563614d696e676172656c6c692f437279707450616e6461732f6d61737465722f637279707470616e6461732f7265732f656e637279707465642e737667)
About
CryptPandas allows you to easily encrypt and decrypt pandas dataframe, regardless of their content.
Installation
You can install with pip as:
pip install cryptpandas
Example
Encrypting and decrypting your pandas dataframe is easy:
import pandas as pd
import cryptpandas as crp
df = pd.DataFrame({'A': [1, 2, 3],
'B': ['one', 'one', 'four']})
crp.to_encrypted(df, password='mypassword123', path='file.crypt')
decrypted_df = crp.read_encrypted(path='file.crypt', password='mypassword123')
print((df == decrypted_df).all().all())
By default CryptPandas uses PBKDF2 with a default salt. This allows anyone with your chosen password or passphrase to decrypt the content of your encrypted dataframe.
For an additional layer of security you can generate your own salt with cryptpandas.make_salt
.
For example:
import pandas as pd, cryptpandas as crp
df = pd.DataFrame({'A': [1, 2, 3],
'B': ['one', 'one', 'four']})
my_salt = crp.make_salt()
crp.to_encrypted(df, password='mypassword123', path='file.crypt', salt=my_salt)
decrypted_df = crp.read_encrypted(path='file.crypt', password='mypassword123', salt=my_salt)
Now it is possible to decrypt the encrypted dataframe only if in possession of both the salt and the password.
Requirements
pandas
cryptography
pyarrow
Author
Luca Mingarelli, 2020
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for CryptPandas-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78086739bcc7c92a975d8227eac730e6243e346900a04e547764c43745c6397a |
|
MD5 | 32c0e28fef945a46d385636e40284026 |
|
BLAKE2b-256 | 60ebb5440cdf5ae086e11d3478bf4ef47ee026ae1cfce5472bbf52853c0a11d1 |