From b0b2d1fd7ba016aebf9d8a3c2360543326a2dc5b Mon Sep 17 00:00:00 2001 From: Doug Branton Date: Thu, 23 May 2024 10:24:24 -0700 Subject: [PATCH] add loading example --- docs/tutorials/loading_data.ipynb | 63 ++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/docs/tutorials/loading_data.ipynb b/docs/tutorials/loading_data.ipynb index 3b47ad2..1c24d8c 100644 --- a/docs/tutorials/loading_data.ipynb +++ b/docs/tutorials/loading_data.ipynb @@ -6,11 +6,72 @@ "source": [ "# Loading Data into Nested-Dask" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import nested_pandas as npd\n", + "import nested_dask as nd" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## From Nested-Pandas\n", + "\n", + "Nested-Dask can load data from Nested-Pandas `NestedFrame` objects by using the `from_nested_pandas` class function." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Create a Nested-Pandas NestedFrame\n", + "nf = npd.NestedFrame(data={\"a\": [1, 2, 3], \"b\": [2, 4, 6]}, index=[0, 1, 2])\n", + "\n", + "nested = npd.NestedFrame(\n", + " data={\"c\": [0, 2, 4, 1, 4, 3, 1, 4, 1], \"d\": [5, 4, 7, 5, 3, 1, 9, 3, 4]},\n", + " index=[0, 0, 0, 1, 1, 1, 2, 2, 2],\n", + ")\n", + "\n", + "nf = nf.add_nested(nested, \"nested\")\n", + "\n", + "# Convert to Nested-Dask NestedFrame\n", + "nf = nd.NestedFrame.from_nested_pandas(nf)\n", + "nf" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Loading from Parquet Files" + ] } ], "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, "language_info": { - "name": "python" + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.11" } }, "nbformat": 4,