Skip to main content

Notion-DF: Seamlessly Connecting Notion Database with Pandas DataFrame

Project description

notion-df: Seamlessly Connecting Notion Database with Pandas DataFrame

Please Note: This project is currently in pre-alpha stage. The code are not appropriately documented and tested. Please report any issues you find.

Installation

pip install notion-df

Usage

  • Before starting, please follow the instructions to create a new integration and add it to your Notion page or database.

    • We'll refer Internal Integration Token as the api_key below.
  • Pandas-flavored APIs: Just need to add two additional lines of code:

    import notion_df
    notion_df.pandas() #That's it!
    
    import pandas as pd
    df = pd.read_notion(page_url, api_key=api_key)
    df.to_notion(page_url)
    
  • Download your Notion table as a pandas DataFrame

    import notion_df
    df = notion_df.download(notion_database_url, api_key=api_key)
    # Equivalent to: df = pd.read_notion(notion_database_url, api_key=api_key)
    df.head()
    
    Only downloading the first `nrows` from a database
    df = notion_df.download(notion_database_url, nrows=nrows) #e.g., 10
    
  • Append a local df to a Notion database:

    import notion_df
    notion_df.upload(df, notion_database_url, title="page-title", api_key=api_key)
    # Equivalent to: df.to_notion(notion_database_url, title="page-title", api_key=api_key)
    
  • Upload a local df to a newly created database in a Notion page:

    import notion_df
    notion_df.upload(df, notion_page_url, title="page-title", api_key=api_key)
    # Equivalent to: df.to_notion(notion_page_url, title="page-title", api_key=api_key)
    
  • Tired of typing api_key=api_key each time?

    import notion_df
    notion_df.config(api_key=api_key) # Or set an environment variable `NOTION_API_KEY`
    df = notion_df.download(notion_database_url)
    notion_df.upload(df, notion_page_url, title="page-title")
    # Similarly in pandas APIs: df.to_notion(notion_page_url, title="page-title")
    

TODOs

  • Add tests for
    • load
    • upload
    • values.py
    • configs.py
    • base.py
  • Better class organizations/namings for *Configs and *Values

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

notion-df-0.0.3.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

notion_df-0.0.3-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file notion-df-0.0.3.tar.gz.

File metadata

  • Download URL: notion-df-0.0.3.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for notion-df-0.0.3.tar.gz
Algorithm Hash digest
SHA256 f70e65899b401240469f410bacfc35306fa87577453de619cff6eec6412534ce
MD5 08e86a490e2b860c1f9cb43e147a09d5
BLAKE2b-256 2a493909f34e3bb6f8b220d27b92ad45619d04c4d2200a86094ce404b43dcdd7

See more details on using hashes here.

File details

Details for the file notion_df-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: notion_df-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for notion_df-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4fc81d275ebd20140740c2b1c8910bd4fbe9c9a0324457ca5c14dc502ccabcf9
MD5 7ff06ef083b7e3e800664c29102d4e8d
BLAKE2b-256 71384300f613e7ae2c01dfd2970cbb6a0da7e28ca37e68b6ef84980bc8865d94

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