This is an automated email from the ASF dual-hosted git repository.
jiayu pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-db.git
The following commit(s) were added to refs/heads/main by this push:
new 6c43083 Fix docs for building docs, add docstring for
create_data_frame (#25)
6c43083 is described below
commit 6c43083bf455a7d267019daefd5ef95b4fd82a9d
Author: Kristin Cowalcijk <[email protected]>
AuthorDate: Sat Sep 6 01:07:20 2025 +0800
Fix docs for building docs, add docstring for create_data_frame (#25)
---
docs/README.md | 1 +
docs/requirements.txt | 1 +
python/sedonadb/python/sedonadb/context.py | 28 ++++++++++++++++++++++++++++
3 files changed, 30 insertions(+)
diff --git a/docs/README.md b/docs/README.md
index 0ed8193..c93ae96 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -22,6 +22,7 @@
SedonaDB's documentation is powered by [mkdocs.org](https://www.mkdocs.org)
and [mkdocs-material](https://squidfunk.github.io/mkdocs-material/reference/).
To build the documentation locally, clone the repo, install the Python
requirements, and use the `mkdocs` command-line tool to build or serve the
documentation.
```shell
+pip install -e "python/sedonadb/[test]" -vv # OPTIONAL: build the doc for the
latest dev version of sedona-db
git clone https://github.com/apache/sedona-db.git && cd sedona-db
pip install -r docs/requirements.txt
```
diff --git a/docs/requirements.txt b/docs/requirements.txt
index 385ba6d..1804be8 100644
--- a/docs/requirements.txt
+++ b/docs/requirements.txt
@@ -8,3 +8,4 @@ mkdocstrings[python]
ruff
ipykernel
notebook
+sedonadb[geopandas]
diff --git a/python/sedonadb/python/sedonadb/context.py
b/python/sedonadb/python/sedonadb/context.py
index c408f53..6531b86 100644
--- a/python/sedonadb/python/sedonadb/context.py
+++ b/python/sedonadb/python/sedonadb/context.py
@@ -35,6 +35,34 @@ class SedonaContext:
self._impl = InternalContext()
def create_data_frame(self, obj, schema=None) -> DataFrame:
+ """Create a DataFrame from an in-memory or protocol-enabled object.
+
+ Converts supported Python objects into a SedonaDB DataFrame so you
+ can run SQL and spatial operations on them.
+
+ Args:
+ obj: A supported object:
+ - pandas DataFrame
+ - GeoPandas DataFrame
+ - Polars DataFrame
+ - pyarrow Table
+ schema: Optional object implementing ``__arrow_schema__`` for
providing an Arrow schema.
+
+ Returns:
+ DataFrame: A SedonaDB DataFrame.
+
+ Examples:
+
+ >>> import sedonadb, pandas as pd
+ >>> con = sedonadb.connect()
+ >>> con.create_data_frame(pd.DataFrame({"x": [1,
2]})).head(1).show()
+ ┌───────┐
+ │ x │
+ │ int64 │
+ ╞═══════╡
+ │ 1 │
+ └───────┘
+ """
return _create_data_frame(self._impl, obj, schema)
def view(self, name: str) -> DataFrame: