Skip to content

Commit

Permalink
add loading example
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbrn committed May 23, 2024
1 parent efe8af9 commit b0b2d1f
Showing 1 changed file with 62 additions and 1 deletion.
63 changes: 62 additions & 1 deletion docs/tutorials/loading_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit b0b2d1f

Please sign in to comment.