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:
- DataFrame with property keys as column names: an option to get the DataFrame back with Notion's internal property keys as column names instead of their display names. More cumbersome to read, but immune to column renames in Notion, so your code doesn't break when someone renames a property on the Notion side.
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.
Metadata
Release files for notion2pandas 3.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| notion2pandas-3.2.0.tar.gz | 2.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| notion2pandas-3.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.4 MB
Release files / notion2pandas-3.2.0.tar.gz
| Download URL | notion2pandas-3.2.0.tar.gz |
|---|---|
| Size | 2.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a035d72e7846993e0b9a9d187b6495eaa6d6b787078007133b0f81434411a96c
|
|
BLAKE2b-256 checksum How to use checksums |
74787f69f55220a35b19ce4dc217e2c98a0959f9774b8550fd2c1798d6996e5b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|
Release files / notion2pandas-3.2.0-py3-none-any.whl
| Download URL | notion2pandas-3.2.0-py3-none-any.whl |
|---|---|
| Size | 45.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
acfcdba4d68a31794176463fe4830996db636b11ffd381dde4606c93eae021bc
|
|
BLAKE2b-256 checksum How to use checksums |
31ea76225a0a1fbb29c794a8c306780f5f92df91ec7f63432eba39ae8023f9c3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.12
|