A tool for encryption and decryption of pandas dataframes.
Project description
CryptPandas
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
File details
Details for the file CryptPandas-1.0.1.tar.gz
.
File metadata
- Download URL: CryptPandas-1.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 467167954720da9beceefcd953ccb6ed9d0fd25a360aeb647a2907ea67cb1f84 |
|
MD5 | bbe632f48973b7549bf33242df65c5e6 |
|
BLAKE2b-256 | 3945d85286e5c3a068ebb4ac93615e23aee20ffaa9ae17c0a0b066b182ce5993 |
File details
Details for the file CryptPandas-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: CryptPandas-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 78086739bcc7c92a975d8227eac730e6243e346900a04e547764c43745c6397a |
|
MD5 | 32c0e28fef945a46d385636e40284026 |
|
BLAKE2b-256 | 60ebb5440cdf5ae086e11d3478bf4ef47ee026ae1cfce5472bbf52853c0a11d1 |