Skip to main content

Notion Client extension to import notion Database into pandas Dataframe

Project description

Notion2Pandas

Notion2Pandas is a Python 3 package that extends the capabilities of the excellent notion-sdk-py by Ramnes. It enables the seamless import of a Notion database into a pandas dataframe and vice versa, requiring just a single line of code.

Installation

pip install notion2pandas

Quick Start

Synchronous Client

from notion2pandas import Notion2PandasClient
import os

# Create client
n2p = Notion2PandasClient(auth=os.environ["NOTION_TOKEN"])

# Import database to NotionDataFrame
ndf = n2p.get_dataframe(os.environ["DATABASE_ID"])

# Work with your data
ndf.loc[ndf['Status'] == 'Todo', 'Status'] = 'In Progress'

# Save changes back to Notion
n2p.sync_to_notion(ndf)

Asynchronous Client

from notion2pandas import AsyncNotion2PandasClient
import os

# Create async client
async_n2p = AsyncNotion2PandasClient(auth=os.environ["NOTION_TOKEN"])

# Import database to NotionDataFrame (concurrent processing)
ndf = await async_n2p.get_dataframe(os.environ["DATABASE_ID"])

# Work with your data
ndf.loc[ndf['Status'] == 'Todo', 'Status'] = 'In Progress'

# Save changes back to Notion (concurrent updates)
await async_n2p.sync_to_notion(ndf)

For more complete, real-world examples, see the examples folder.



📖 Documentation

This README covers the basics. For everything else — filters and sorts, data sources, templates, callbacks, custom read/write functions, logging, and more — see the full documentation.


Migrating from v1.x

Version 2.0 introduces several improvements and breaking changes. If you're upgrading from v1.x:

v1.x v2.0
from_notion_DB_to_dataframe() get_dataframe()
update_notion_DB_from_dataframe() sync_to_notion()
from_notion_database_to_dataframes() get_dataframes()
delete_rows_and_pages() delete_pages()
Returns pd.DataFrame Returns NotionDataFrame
PageID column page_id index
Manual row appending ndf.add_page()

📖 Complete migration guide with examples: MIGRATION-GUIDE.md
📚 v1.x documentation: README-v1.md

All v1.x methods still work with deprecation warnings - you have time to migrate!

Roadmap

Planned features for upcoming releases:

  • Managing the 2700 API calls / 15 minutes rate limit

Examples

Real-world scripts covering common use cases are available in the examples folder.

Changelog

View the complete version history on the changelog page.

Support

Notion2Pandas is an open-source project. Contributions are welcome!

  • Report Issues: Found a bug? Open an issue
  • Propose Changes: Have an improvement? Submit a merge request
  • Fork the Project: Disagree with the direction? You're free to fork with our blessing!

All proposals will be evaluated and responded to.

License

This project is open-source and available under the MIT License.

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

notion2pandas-2.5.0.tar.gz (2.0 MB view details)

Uploaded Source

Built Distribution

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

notion2pandas-2.5.0-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file notion2pandas-2.5.0.tar.gz.

File metadata

  • Download URL: notion2pandas-2.5.0.tar.gz
  • Upload date:
  • Size: 2.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for notion2pandas-2.5.0.tar.gz
Algorithm Hash digest
SHA256 a4223aab5f53155a736262d6f4e64ac109d53eb9cec37281c118e85d72642aa7
MD5 1112a3c6773c9ecccd45377d7d6927d2
BLAKE2b-256 0cb9715d3d7f93b5fda45dc6f9e4e1ab67c1805b5eb4c04a36fe179cb4e9e8a7

See more details on using hashes here.

File details

Details for the file notion2pandas-2.5.0-py3-none-any.whl.

File metadata

  • Download URL: notion2pandas-2.5.0-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for notion2pandas-2.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0d8c17f8ea6427c8b6c15e52e78de10138306d70138ae1d9757124ad7fcdd70
MD5 b340105664b0aedff4533584f87a374b
BLAKE2b-256 326e516e0952c657dbcf64c57b023f03a9f566ab3d7ad1f4800603bd8c7cb0c5

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