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 "git+https://github.com/lolipopshock/notion-df.git#egg=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 theapi_key
below.
- We'll refer
-
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.load(notion_database_url, api_key=api_key) # Equivalent to: df = pd.read_notion(notion_database_url, api_key=api_key) df.head()
-
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.load(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.1.tar.gz
(11.1 kB
view hashes)
Built Distribution
notion_df-0.0.1-py3-none-any.whl
(12.2 kB
view hashes)
Close
Hashes for notion_df-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a36105ca8c86304305d5419253646463103b4d8a4734e0c0ab9a1314524f6a4 |
|
MD5 | f5ee0f57d6fcc40d38d2f191a33aff54 |
|
BLAKE2b-256 | c6e98a5642dfe06fed7d9781210a6738e36715ee035c4cc9293d23b9b7b000e3 |