Skip to content

Commit 0705fdc

Browse files
committed
Embedding docs
1 parent 5b1986d commit 0705fdc

File tree

1 file changed

+105
-9
lines changed

1 file changed

+105
-9
lines changed

docs/tutorials/data_manipulation.ipynb

Lines changed: 105 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@
1717
{
1818
"cell_type": "code",
1919
"execution_count": null,
20-
"metadata": {},
20+
"metadata": {
21+
"ExecuteTime": {
22+
"end_time": "2025-03-05T23:08:41.890895Z",
23+
"start_time": "2025-03-05T23:08:41.872743Z"
24+
}
25+
},
2126
"outputs": [],
2227
"source": [
2328
"import nested_pandas as npd\n",
@@ -31,7 +36,12 @@
3136
{
3237
"cell_type": "code",
3338
"execution_count": null,
34-
"metadata": {},
39+
"metadata": {
40+
"ExecuteTime": {
41+
"end_time": "2025-03-05T23:08:41.907431Z",
42+
"start_time": "2025-03-05T23:08:41.902080Z"
43+
}
44+
},
3545
"outputs": [],
3646
"source": [
3747
"# Show one of the nested dataframes\n",
@@ -55,7 +65,12 @@
5565
{
5666
"cell_type": "code",
5767
"execution_count": null,
58-
"metadata": {},
68+
"metadata": {
69+
"ExecuteTime": {
70+
"end_time": "2025-03-05T23:08:41.933782Z",
71+
"start_time": "2025-03-05T23:08:41.930296Z"
72+
}
73+
},
5974
"outputs": [],
6075
"source": [
6176
"# Directly Nested Column Selection\n",
@@ -72,7 +87,12 @@
7287
{
7388
"cell_type": "code",
7489
"execution_count": null,
75-
"metadata": {},
90+
"metadata": {
91+
"ExecuteTime": {
92+
"end_time": "2025-03-05T23:08:41.956770Z",
93+
"start_time": "2025-03-05T23:08:41.953485Z"
94+
}
95+
},
7696
"outputs": [],
7797
"source": [
7898
"ndf[\"nested.t\"] + 100"
@@ -102,7 +122,12 @@
102122
{
103123
"cell_type": "code",
104124
"execution_count": null,
105-
"metadata": {},
125+
"metadata": {
126+
"ExecuteTime": {
127+
"end_time": "2025-03-05T23:08:41.992618Z",
128+
"start_time": "2025-03-05T23:08:41.987910Z"
129+
}
130+
},
106131
"outputs": [],
107132
"source": [
108133
"# prepend lsst_ to the band column\n",
@@ -122,7 +147,12 @@
122147
{
123148
"cell_type": "code",
124149
"execution_count": null,
125-
"metadata": {},
150+
"metadata": {
151+
"ExecuteTime": {
152+
"end_time": "2025-03-05T23:08:42.016312Z",
153+
"start_time": "2025-03-05T23:08:42.012009Z"
154+
}
155+
},
126156
"outputs": [],
127157
"source": [
128158
"# create a new \"corrected_t\" column in \"nested\"\n",
@@ -135,7 +165,12 @@
135165
{
136166
"cell_type": "code",
137167
"execution_count": null,
138-
"metadata": {},
168+
"metadata": {
169+
"ExecuteTime": {
170+
"end_time": "2025-03-05T23:08:42.037065Z",
171+
"start_time": "2025-03-05T23:08:42.032519Z"
172+
}
173+
},
139174
"outputs": [],
140175
"source": [
141176
"# Show the first dataframe again\n",
@@ -159,7 +194,12 @@
159194
{
160195
"cell_type": "code",
161196
"execution_count": null,
162-
"metadata": {},
197+
"metadata": {
198+
"ExecuteTime": {
199+
"end_time": "2025-03-05T23:08:42.075674Z",
200+
"start_time": "2025-03-05T23:08:42.061111Z"
201+
}
202+
},
163203
"outputs": [],
164204
"source": [
165205
"ndf[\"bands.band_label\"] = ndf[\"nested.band\"]\n",
@@ -176,11 +216,67 @@
176216
{
177217
"cell_type": "code",
178218
"execution_count": null,
179-
"metadata": {},
219+
"metadata": {
220+
"ExecuteTime": {
221+
"end_time": "2025-03-05T23:08:42.132918Z",
222+
"start_time": "2025-03-05T23:08:42.114796Z"
223+
}
224+
},
180225
"outputs": [],
181226
"source": [
182227
"ndf.add_nested(ndf[\"nested.band\"].to_frame(), \"bands_from_add_nested\")"
183228
]
229+
},
230+
{
231+
"cell_type": "markdown",
232+
"metadata": {},
233+
"source": [
234+
"## Embedding \"base\" column into nested column"
235+
]
236+
},
237+
{
238+
"cell_type": "markdown",
239+
"metadata": {},
240+
"source": [
241+
"We can also assign some \"base\" (non-nested) column to a nested column, which will be broadcasted to all nested dataframes with the values being repeated."
242+
]
243+
},
244+
{
245+
"cell_type": "code",
246+
"execution_count": null,
247+
"metadata": {
248+
"ExecuteTime": {
249+
"end_time": "2025-03-05T23:08:42.165933Z",
250+
"start_time": "2025-03-05T23:08:42.161684Z"
251+
}
252+
},
253+
"outputs": [],
254+
"source": [
255+
"ndf[\"nested.a\"] = ndf[\"a\"]\n",
256+
"ndf[\"nested.a\"]"
257+
]
258+
},
259+
{
260+
"cell_type": "markdown",
261+
"metadata": {},
262+
"source": [
263+
"Or we can do some operations over the base columns first:"
264+
]
265+
},
266+
{
267+
"cell_type": "code",
268+
"execution_count": null,
269+
"metadata": {
270+
"ExecuteTime": {
271+
"end_time": "2025-03-05T23:08:42.266923Z",
272+
"start_time": "2025-03-05T23:08:42.262281Z"
273+
}
274+
},
275+
"outputs": [],
276+
"source": [
277+
"ndf[\"nested.ab\"] = ndf[\"a\"] + ndf[\"b\"] * 2\n",
278+
"ndf[\"nested.ab\"]"
279+
]
184280
}
185281
],
186282
"metadata": {

0 commit comments

Comments
 (0)