Skip to main content

Create ERD/data flow diagrams from pandas dataframes.

Project description

Create ERD diagram from pandas dataframes

  • create an ERD object and add tables and connections between tables
  • save the generated dot code to an output.txt file containing
  • copy-paste the output.txt into a graphviz rendering tool like this one
  • the output image at the bottom is generated by using the above link

Installation via pip:

pip install pandaserd

Example use:

import pandas as pd
from pandaserd import ERD

df1 = pd.DataFrame(data=[[123, 32, '1 Ottawa Street'], [123, 80, '14 Canada Road']])
df1.columns = ['PERSON', 'AGE', 'ADDRESS']
df2 = pd.DataFrame(data=[[6342, 124123124124, '1992-01-02', 21, 'K012V4'], [3124, 154823124124, '1984-02-02',42,'L4Y6S2']])
df2.columns = ['PERSON', 'CREDIT_CARD', 'DOB', 'PERSON_AGE', 'POSTAL_CODE']

erd = ERD()
t1 = erd.add_table(df1, 'PERSON', bg_color='pink')
t2 = erd.add_table(df2, 'CREDIT_CARD', bg_color='skyblue')
erd.create_rel('PERSON', 'CREDIT_CARD', on='PERSON', right_cardinality='*')
erd.create_rel('PERSON', 'CREDIT_CARD', left_on='AGE', right_on='PERSON_AGE', left_cardinality='+', right_cardinality='+')

erd.write_to_file('output.txt')

example image

Credits

Largely inspired by this fab repo!

  • dot documentation can be found here

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

pandaserd-0.1.5.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

pandaserd-0.1.5-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file pandaserd-0.1.5.tar.gz.

File metadata

  • Download URL: pandaserd-0.1.5.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for pandaserd-0.1.5.tar.gz
Algorithm Hash digest
SHA256 43079dfd41f580facad472cb7abda493c4f7dff7546ca0ab9f6519b4e4752eea
MD5 1676051baeeeccc07b0d3d5166741e09
BLAKE2b-256 25bfc2771476af6d7c6d19eb81668ac3c631d8ff5ad8ad4ff7684cff968de809

See more details on using hashes here.

File details

Details for the file pandaserd-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pandaserd-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.2 CPython/3.9.1

File hashes

Hashes for pandaserd-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bc64168e3f31d96f7fb5340d7fec0e522c182eb0450ec0c2f09bdb7223e6be87
MD5 008fbc651186176836506d177200b2ba
BLAKE2b-256 c2f46edd68af0968cac60b17435dd6047578b1d59f3625440473ebacd1a57d1f

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