Skip to content

Commit c49b9e9

Browse files
nitbharambemgovers
andauthored
Apply suggestions from code review minor
Co-authored-by: Martijn Govers <[email protected]> Signed-off-by: Nitish Bharambe <[email protected]>
1 parent b8dd1b0 commit c49b9e9

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/examples/arrow_example.ipynb

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"\n",
1111
"It is by no means intended to provide complete documentation on the topic, but only to show how such conversions could be done.\n",
1212
"\n",
13-
"This example uses `pyarrow.RecordBatch` to demonstrate zero copy operations. The user can choose a `pyarrow.Table` or other structures based on the requirement.\n",
13+
"This example uses `pyarrow.RecordBatch` to demonstrate zero-copy operations. The user can choose a `pyarrow.Table` or other structures based on the requirement.\n",
1414
"\n",
1515
"**NOTE:** To run this example, the optional `examples` dependencies are required:\n",
1616
"\n",
@@ -78,7 +78,7 @@
7878
"\n",
7979
"Construct the input data for the model and construct the actual model.\n",
8080
"\n",
81-
"Arrow uses a columnar data format while the power-grid-model offers both: row based or columnar data format.\n",
81+
"Arrow uses a columnar data format while the power-grid-model offers support for both row based and columnar data format.\n",
8282
"Because of this, the columnar data format of power-grid-model provides a zero-copy interface for Arrow data. This differs from the row-based data format, for which conversions always require a copy."
8383
]
8484
},
@@ -123,11 +123,11 @@
123123
"metadata": {},
124124
"source": [
125125
"The primitive types of each attribute in the arrow tables need to match to make the operation efficient.\n",
126-
"A zero copy is not guaranteed if the data types from power_grid_meta_data / initialize_array are not used.\n",
126+
"Zero-copy conversion is not guaranteed if the data types provided via the PGM via `power_grid_meta_data` are not used.\n",
127127
"Note that the asymmetric type of attribute in power-grid-model has a shape of `(3,)` along with a specific type. These represent the 3 phases of electrical system.\n",
128-
"Hence asymmetric attributes need to be handled specially. \n",
128+
"Hence, special care is required when handling asymmetric attributes. \n",
129129
"\n",
130-
"In this tutorial we use the respective primitive types for the symmetrical attributes and a `FixedSizeListArray` of the primitive types with length 3 for asymmetrical attributes. This results in them being stored as contigious memory which would enable zero copy conversion. There might be other ways to approach this problem too."
130+
"In this example, we use the respective primitive types for the symmetrical attributes and a `FixedSizeListArray` of the primitive types with length 3 for asymmetrical attributes. This results in them being stored as contiguous memory which would enable zero-copy conversion. Other possible solutions to this problem are beyond the scope of this example."
131131
]
132132
},
133133
{
@@ -179,9 +179,9 @@
179179
" return pa.schema(schemas)\n",
180180
"\n",
181181
"\n",
182-
"print(\"-------node combined asym scehma-------\")\n",
182+
"print(\"-------node combined asym schema-------\")\n",
183183
"print(pgm_schema(DatasetType.input, ComponentType.node))\n",
184-
"print(\"-------asym load combined asym scehma-------\")\n",
184+
"print(\"-------asym load combined asym schema-------\")\n",
185185
"print(pgm_schema(DatasetType.input, ComponentType.asym_load))"
186186
]
187187
},
@@ -269,7 +269,7 @@
269269
"Converting Arrow data to columnar NumPy arrays is recommended to leverage the columnar nature of Arrow data. \n",
270270
"This conversion can be done with zero-copy operations.\n",
271271
"\n",
272-
"Similar approach be adopted by the user to convert to row based data.\n",
272+
"A similar approach be adopted by the user to convert to row based data.\n",
273273
"\n",
274274
"```{note}\n",
275275
"The option of `zero_copy_only` in the function below is added in this demo to verify no copies are made. Its usage is not mandatory to do zero copy conversion.\n",

0 commit comments

Comments
 (0)