Skip to main content

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

Release files for CryptPandas 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for CryptPandas 1.0.1
File Size Uploaded
CryptPandas-1.0.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for CryptPandas 1.0.1
File Interpreter ABI Platform
CryptPandas-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / CryptPandas-1.0.1.tar.gz

Download URL CryptPandas-1.0.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
467167954720da9beceefcd953ccb6ed9d0fd25a360aeb647a2907ea67cb1f84
BLAKE2b-256 checksum
How to use checksums
3945d85286e5c3a068ebb4ac93615e23aee20ffaa9ae17c0a0b066b182ce5993
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.13

Release files / CryptPandas-1.0.1-py3-none-any.whl

Download URL CryptPandas-1.0.1-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78086739bcc7c92a975d8227eac730e6243e346900a04e547764c43745c6397a
BLAKE2b-256 checksum
How to use checksums
60ebb5440cdf5ae086e11d3478bf4ef47ee026ae1cfce5472bbf52853c0a11d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.10.13

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

1.0.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page