Skip to content

Commit 78d4def

Browse files
committed
Add a section about the dataframes loading to example-notebook.ipynb
1 parent 6e24fd4 commit 78d4def

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

example-notebook.ipynb

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,43 @@
12581258
"!ls -lah data # only works on macOS and Linux systems"
12591259
]
12601260
},
1261+
{
1262+
"cell_type": "markdown",
1263+
"metadata": {},
1264+
"source": [
1265+
"Alternatively, you can save the learner's data as a `pandas.DataFrame` like"
1266+
]
1267+
},
1268+
{
1269+
"cell_type": "code",
1270+
"execution_count": null,
1271+
"metadata": {},
1272+
"outputs": [],
1273+
"source": [
1274+
"df = learner.to_dataframe()\n",
1275+
"df"
1276+
]
1277+
},
1278+
{
1279+
"cell_type": "markdown",
1280+
"metadata": {},
1281+
"source": [
1282+
"And load it into an empty learner with"
1283+
]
1284+
},
1285+
{
1286+
"cell_type": "code",
1287+
"execution_count": null,
1288+
"metadata": {},
1289+
"outputs": [],
1290+
"source": [
1291+
"# This will even set the default arguments to the function `peak`\n",
1292+
"# so we do not need to partial it\n",
1293+
"control = adaptive.Learner1D(peak, bounds=(-1, 1))\n",
1294+
"control.load_dataframe(df)\n",
1295+
"learner.plot().relabel(\"saved learner\") + control.plot().relabel(\"loaded learner\")"
1296+
]
1297+
},
12611298
{
12621299
"cell_type": "markdown",
12631300
"metadata": {},

0 commit comments

Comments
 (0)