Skip to main content

Share and Edit Pandas Dataframes with a Link!

Project description

image

share-df: Instantly Share and Modify Dataframes With a Web Interface From Anywhere

pip installs: PyPI Downloads version: PyPI Latest Release

Goal

This package enables cross-collaboration between nontechnical and technical contributors by allowing developers to generate a URL for free with one line of code that they can then send to nontechnical contributors enabling them to modify the dataframe with a web app. Then, they can send it back to the developer, directly generating the modified dataframe, maintaining code continuity, and removing the burden of file transfer and conversion to other file formats.

Technical Contributor Features

  • pip install share-df
  • one function call to generate a link to send, accessible anywhere
  • changes made by the client are received back as a dataframe for seamless development

Nontechnical Contributor Features

  • Easy Google OAuth login
  • Seamless UI to modify the dataframe
    • Change column names
    • Drag around columns
    • Change all values
    • Rename columns
    • Add new columns and rows
  • Send the results back with the click of a button

How to Run

  1. pip install share-df
  2. If you do not already have one, generate an auth token for free in less than a minute with ngrok
  3. Create a .env file in your directory with NGROK_AUTHTOKEN=
  4. import and call the function on any df!

Example Code

import pandas as pd
from share_df import pandaBear

df = pd.DataFrame({
    'Name': ['John', 'Alice', 'Bob', 'Carol'],
    'City': ['New York', 'London', 'Paris', 'Tokyo'],
    'Salary': [50000, 60000, 75000, 65000]
})

df = pandaBear(df)
print(df)

Google Colab

  • This code works by creating a localhost and then tunneling traffic to make it accessible to other people.
  • Thereby, since Google Colab code runs on a VM this is an interesting challenge to handle.
  • As of 0.1.7 the package offers support for creating a Google-generated link for DFs but this link is not shareable.
  • For Google Colab instead of using a .env I recommend putting your NGROK_AUTHTOKEN into the Google Colab secrets manager (key icon on the left side of the screen). That way your secrets also can be synced to other notebooks and you don't have to repeat the .env uploading each time.
  • I initially aimed for full functionality (link sharing) with Google Colab however it seems impossible as Colab locks it to Colab session authentification.
  • Google has also stated that they may deprecate their serve_kernel_port_as_window function in the future in which case it will be swapped to serve_kernel_port_as_iframe and the same functionality will remain except it will be in the IFrame.

https://github.com/user-attachments/assets/373ec28c-d61e-467b-9b54-ff6225126396

Future Features

  • Better Dataframe handling (pagination, lazy loading, better frontend for big data)
  • Better Security (input sanitization, CSRF protection, configurable endpoint rate limiting)
  • Better UI (search, dark mode, export option)
  • IFrame Usage Option in Google Colab
  • True Asynchronicity with ipyparallel
  • Code Recreation (instead of overwriting the df just solve the code needed)
  • Multiple authenticated users

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

share_df-1.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

share_df-1.0.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

Details for the file share_df-1.0.0.tar.gz.

File metadata

  • Download URL: share_df-1.0.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.5.0

File hashes

Hashes for share_df-1.0.0.tar.gz
Algorithm Hash digest
SHA256 72a1b6f85a77a75118689ffe899f3a9304391af2d86771871571bf470e2662be
MD5 efed928239e1a97fa4b6ae17a3aca9ea
BLAKE2b-256 d6dcd6b272da260f6e562665b8bed18a753c4e8fff8a78737cebc7b0b413030e

See more details on using hashes here.

File details

Details for the file share_df-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: share_df-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.5.0

File hashes

Hashes for share_df-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e4e0a259fd929a6569e162a4907212c189fe0c4c3cf6f2eee7b8581f68f05e3
MD5 c73b380c21f7338709eb743f95f268af
BLAKE2b-256 37fb59f59ec2ebfd023464fdb6eba77c151bbc7b11a931244c3d980aca814c57

See more details on using hashes here.

Supported by

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