Skip to main content

A tool for encryption and decryption of pandas dataframes.

Project description

CryptPandas

version

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.write_encrypted(df, path='file.crypt', password='mypassowrd123')

decrypted_df = crp.read_encrypted(path='file.crypt', password='mypassowrd123')

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.write_encrypted(df, path='file.crypt', password='mypassowrd123', salt=my_salt)

decrypted_df = crp.read_encrypted(path='file.crypt', password='mypassowrd123', 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-0.0.3.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

CryptPandas-0.0.3-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

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