pip install "dask[complete]"★Full install — array/dataframe/bag +distributed.conda install dask -c conda-forgeSame, via conda-forge.import dask.dataframe as dd★pandas at scale.import dask.array as daNumPy at scale.import dask.bag as dbMessy / semi-structured data.import daskFordelayed&dask.compute.dask.__version__CalVer, e.g.'2026.7.1'.
dask.dataframe★Bigger-than-memory / many pandas frames.dask.array★Large N-dimensional NumPy arrays.dask.bagJSON/log/text objects — pre-DataFrame ETL.dask.delayed★Wrap arbitrary Python into a custom graph.distributed futuresReal-time, eager tasks (needs aClient).dask_mlScalable scikit-learn-style ML.
dd.read_csv("data/*.csv")★Many files → one lazy DataFrame (globs OK).dd.read_parquet("data/")★Preferred format — columnar, splittable.dd.read_parquet(p, columns=[...])Column projection — reads far less.dd.from_pandas(df, npartitions=8)Split an in-memory pandas frame.dd.read_sql_table(…)Pull from a database in parallel.ddf.to_parquet("out/")★Write one Parquet file per partition.
ddf[ddf.x > 0]★lazyBoolean row filter — same as pandas.ddf.groupby("k").y.mean()★Split-apply-combine across partitions.ddf.assign(z=ddf.x + ddf.y)Add a derived column.ddf.merge(other, on="id")Join — a shuffle unless index-aligned.ddf.x.value_counts()Frequency table of a column.ddf.map_partitions(func)★Run a pandas function on each partition.
da.from_array(x, chunks=(1000,1000))★Wrap a NumPy / HDF5 / Zarr array.da.ones((10000,10000), chunks=1000)ones/zeros/full/arange, chunked.da.random.random((10000,10000))★Chunked random data for testing.da.from_zarr("data.zarr")Cloud-friendly, chunk-aligned reads.x.chunksInspect the chunk grid (tuple of tuples).x.rechunk((2000,2000))Re-tile — may move data between chunks.
x + x.T★lazyElementwise math & broadcasting.x.mean(axis=0)★Reductions along axes (sum,std…).x @ yMatrix multiply / dot product.da.linalg.svd(x)Parallel linear algebra, QR, etc.x.map_blocks(func)★Apply a NumPy function per chunk.da.map_overlap(f, x, depth=1)Stencils — shares a halo of neighbor rows.
db.read_text("*.json")★Lines of text → a bag of strings.db.from_sequence(seq, npartitions=4)Any Python iterable → a bag.b.map(json.loads)★Apply a function to every element.b.filter(lambda d: d["ok"])Keep elements passing a predicate.b.pluck("name")Grab one field from each dict.b.foldby(key, binop)Streaming group-and-reduce.b.to_dataframe()★Hand cleaned records to a DataFrame.
@dask.delayed★lazyDecorate a function so calls become tasks.dask.delayed(func)(a, b)Wrap a single call without decorating.total = dask.delayed(sum)(parts)Chain delayed results into a graph.total.compute()★Run the whole graph in parallel.# many delayed calls,Rule: build lots of tasks, thencomputeonce.
x.compute()★Run → concrete pandas / numpy / list.dask.compute(a, b, c)★Compute several at once — shares subresults.x.persist()★Run now, keep as a Dask object in memory.x.compute(scheduler="processes")Override the scheduler for this call.ddf.head()Small peek — runs just the first partition.
from dask.distributed import Client★The "advanced" scheduler — local or remote.client = Client()★Spin up a local cluster + dashboard.Client(n_workers=4, threads_per_worker=2)Shape workers × threads explicitly.Client("tcp://scheduler:8786")Connect to an existing cluster.client.dashboard_link★Live diagnostics at:8787.dask.config.set(scheduler="threads")threads·processes·synchronous.client.close()Shut the cluster down.
fut = client.submit(func, x)★Starts running immediately (not lazy).futs = client.map(func, seq)One future per item.fut.result()Block until done, gather one result.client.gather(futs)★Collect many results back to the client.as_completed(futs)Iterate results as each finishes.client.scatter(data)Pre-place shared data onto workers.
ddf.npartitions★How many pandas pieces make up the frame.ddf.repartition(partition_size="100MB")★Retile toward the ~100 MB sweet spot.ddf.repartition(npartitions=10)Fewer, fatter partitions after a big filter.ddf.set_index("time")Sorted index → fastloc& joins (expensive).ddf.divisionsThe index bounds of each partition.x.rechunk("auto")Let Dask pick array chunk sizes.
x.visualize()★Draw the task graph (needs graphviz).x.daskThe underlying HighLevelGraph.from dask.diagnostics import ProgressBarProgress bar for the local scheduler.with ProgressBar(): x.compute()Wrap a compute to watch it run.client.dashboard_link★Task stream, memory, workers — live.
for i in …: x.compute()serialComputes one at a time →dask.compute(*xs).da.from_array(np.load(f))embedsLoads locally into the graph — read with Dask.huge / tiny partitionsOOM/overheadToo big = crash; too small = slow. Aim ~100 MB.ddf.set_index(…) # in a loopshuffleA costly reshuffle — do it once, then persist.ddf.iloc[5]unsupportedNo positional row indexing across partitions.