Skip to content

Commit 13b4b8a

Browse files
committed
Make minor editorial changes
1 parent f8df6e3 commit 13b4b8a

File tree

3 files changed

+22
-22
lines changed

3 files changed

+22
-22
lines changed

04_dataframe.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"source": [
2828
"<img src=\"images/pandas_logo.png\" align=\"right\" width=\"28%\">\n",
2929
"\n",
30-
"The `dask.dataframe` module implements a blocked parallel `DataFrame` object that mimics a large subset of the Pandas `DataFrame`. One Dask `DataFrame` is comprised of many in-memory pandas `DataFrames` separated along the index. One operation on a Dask `DataFrame` triggers many pandas operations on the constituent pandas `DataFrame`s in a way that is mindful of potential parallelism and memory constraints.\n",
30+
"The `dask.dataframe` module implements a blocked parallel `DataFrame` object that mimics a large subset of the Pandas `DataFrame` API. One Dask `DataFrame` is comprised of many in-memory pandas `DataFrames` separated along the index. One operation on a Dask `DataFrame` triggers many pandas operations on the constituent pandas `DataFrame`s in a way that is mindful of potential parallelism and memory constraints.\n",
3131
"\n",
3232
"**Related Documentation**\n",
3333
"\n",
@@ -500,7 +500,7 @@
500500
"cell_type": "markdown",
501501
"metadata": {},
502502
"source": [
503-
"But lets try by passing both to a single `compute` call."
503+
"But let's try by passing both to a single `compute` call."
504504
]
505505
},
506506
{
@@ -524,7 +524,7 @@
524524
"- the filter (`df[~df.Cancelled]`)\n",
525525
"- some of the necessary reductions (`sum`, `count`)\n",
526526
"\n",
527-
"To see what the merged task graphs between multiple results look like (and what's shared), you can use the `dask.visualize` function (we might want to use `filename='graph.pdf'` to zoom in on the graph better):"
527+
"To see what the merged task graphs between multiple results look like (and what's shared), you can use the `dask.visualize` function (we might want to use `filename='graph.pdf'` to save the graph to disk so that we can zoom in more easily):"
528528
]
529529
},
530530
{
@@ -560,7 +560,7 @@
560560
"Dask.dataframe operations use `pandas` operations internally. Generally they run at about the same speed except in the following two cases:\n",
561561
"\n",
562562
"1. Dask introduces a bit of overhead, around 1ms per task. This is usually negligible.\n",
563-
"2. When Pandas releases the GIL (coming to `groupby` in the next version) `dask.dataframe` can call several pandas operations in parallel within a process, increasing speed somewhat proportional to the number of cores. For operations which don't release the GIL, multiple processes would be needed to get the same speedup."
563+
"2. When Pandas releases the GIL `dask.dataframe` can call several pandas operations in parallel within a process, increasing speed somewhat proportional to the number of cores. For operations which don't release the GIL, multiple processes would be needed to get the same speedup."
564564
]
565565
},
566566
{

05_distributed.ipynb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,32 +21,32 @@
2121
"As we have seen so far, Dask allows you to simply construct graphs of tasks with dependencies, as well as have graphs created automatically for you using functional, Numpy or Pandas syntax on data collections. None of this would be very useful, if there weren't also a way to execute these graphs, in a parallel and memory-aware way. So far we have been calling `thing.compute()` or `dask.compute(thing)` without worrying what this entails. Now we will discuss the options available for that execution, and in particular, the distributed scheduler, which comes with additional functionality.\n",
2222
"\n",
2323
"Dask comes with four available schedulers:\n",
24-
"- \"threaded\": a scheduler backed by a thread pool\n",
24+
"- \"threaded\" (aka \"threading\"): a scheduler backed by a thread pool\n",
2525
"- \"processes\": a scheduler backed by a process pool\n",
2626
"- \"single-threaded\" (aka \"sync\"): a synchronous scheduler, good for debugging\n",
2727
"- distributed: a distributed scheduler for executing graphs on multiple machines, see below.\n",
2828
"\n",
2929
"To select one of these for computation, you can specify at the time of asking for a result, e.g.,\n",
3030
"```python\n",
3131
"myvalue.compute(scheduler=\"single-threaded\") # for debugging\n",
32-
"```"
33-
]
34-
},
35-
{
36-
"cell_type": "markdown",
37-
"metadata": {},
38-
"source": [
39-
"or set the current default, either temporarily or globally\n",
32+
"```\n",
33+
"\n",
34+
"You can also set a default scheduler either temporarily\n",
4035
"```python\n",
4136
"with dask.config.set(scheduler='processes'):\n",
4237
" # set temporarily for this block only\n",
38+
" # all compute calls within this block will use the specified scheduler\n",
4339
" myvalue.compute()\n",
40+
" anothervalue.compute()\n",
41+
"```\n",
4442
"\n",
45-
"dask.config.set(scheduler='processes')\n",
43+
"Or globally\n",
44+
"```python\n",
4645
"# set until further notice\n",
46+
"dask.config.set(scheduler='processes')\n",
4747
"```\n",
4848
"\n",
49-
"Lets see the difference for the familiar case of the flights data"
49+
"Let's try out a few schedulers on the familiar case of the flights data."
5050
]
5151
},
5252
{

06_distributed_advanced.ipynb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
"cell_type": "markdown",
3737
"metadata": {},
3838
"source": [
39-
"In chapter Distributed, we showed that executing a calculation (created using delayed) with the distributed executor is identical to any other executor. However, we now have access to additional functionality, and control over what data is held in memory.\n",
39+
"In the previous chapter, we showed that executing a calculation (created using delayed) with the distributed executor is identical to any other executor. However, we now have access to additional functionality, and control over what data is held in memory.\n",
4040
"\n",
41-
"To begin, the `futures` interface (derived from the built-in `concurrent.futures`) allow map-reduce like functionality. We can submit individual functions for evaluation with one set of inputs, or evaluated over a sequence of inputs with `submit()` and `map()`. Notice that the call returns immediately, giving one or more *futures*, whose status begins as \"pending\" and later becomes \"finished\". There is no blocking of the local Python session."
41+
"To begin, the `futures` interface (derived from the built-in `concurrent.futures`) allows map-reduce like functionality. We can submit individual functions for evaluation with one set of inputs, or evaluated over a sequence of inputs with `submit()` and `map()`. Notice that the call returns immediately, giving one or more *futures*, whose status begins as \"pending\" and later becomes \"finished\". There is no blocking of the local Python session."
4242
]
4343
},
4444
{
@@ -542,11 +542,11 @@
542542
"\n",
543543
"@delayed\n",
544544
"def summation(*a):\n",
545-
" return sum(*a)\n",
545+
" return sum(a)\n",
546546
"\n",
547547
"ina = [5, 25, 30]\n",
548548
"inb = [5, 5, 6]\n",
549-
"out = summation([ratio(a, b) for (a, b) in zip(ina, inb)])\n",
549+
"out = summation(*[ratio(a, b) for (a, b) in zip(ina, inb)])\n",
550550
"f = c.compute(out)\n",
551551
"f"
552552
]
@@ -586,7 +586,7 @@
586586
"source": [
587587
"ina = [5, 25, 30]\n",
588588
"inb = [5, 0, 6]\n",
589-
"out = summation([ratio(a, b) for (a, b) in zip(ina, inb)])\n",
589+
"out = summation(*[ratio(a, b) for (a, b) in zip(ina, inb)])\n",
590590
"f = c.compute(out)\n",
591591
"c.gather(f)"
592592
]
@@ -634,10 +634,10 @@
634634
"metadata": {},
635635
"source": [
636636
"The trouble with this approach is that Dask is meant for the execution of large datasets/computations - you probably can't simply run the whole thing \n",
637-
"in one local thread, else you wouldn't have used Dask in the first place. So the code above should only be used on a small part of the data that also exchibits the error. \n",
637+
"in one local thread, else you wouldn't have used Dask in the first place. So the code above should only be used on a small part of the data that also exihibits the error. \n",
638638
"Furthermore, the method will not work when you are dealing with futures (such as `f`, above, or after persisting) instead of delayed-based computations.\n",
639639
"\n",
640-
"As alternative, you can ask the scheduler to analyze your calculation and find the specific sub-task responsible for the error, and pull only it and its dependnecies locally for execution."
640+
"As an alternative, you can ask the scheduler to analyze your calculation and find the specific sub-task responsible for the error, and pull only it and its dependnecies locally for execution."
641641
]
642642
},
643643
{

0 commit comments

Comments
 (0)