Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ mkdocstrings[python]
ruff
ipykernel
notebook
sedonadb[geopandas]
28 changes: 28 additions & 0 deletions python/sedonadb/python/sedonadb/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,34 @@ def __init__(self):
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:
Expand Down