Skip to main content

A tool for encryption and decryption of pandas dataframes.

Project description

CryptPandas

CircleCI Build and test GitHub version PyPI Latest Release Codacy Badge Codacy Badge Coverage Snyk Security Score Codacy Security Scan License Downloads Run on Repl.it

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

Python

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

CryptPandas-1.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

CryptPandas-1.0.1-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

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

Hashes for CryptPandas-1.0.1.tar.gz
Algorithm Hash digest
SHA256 467167954720da9beceefcd953ccb6ed9d0fd25a360aeb647a2907ea67cb1f84
MD5 bbe632f48973b7549bf33242df65c5e6
BLAKE2b-256 3945d85286e5c3a068ebb4ac93615e23aee20ffaa9ae17c0a0b066b182ce5993

See more details on using hashes here.

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

Hashes for CryptPandas-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78086739bcc7c92a975d8227eac730e6243e346900a04e547764c43745c6397a
MD5 32c0e28fef945a46d385636e40284026
BLAKE2b-256 60ebb5440cdf5ae086e11d3478bf4ef47ee026ae1cfce5472bbf52853c0a11d1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page