Dask: Install, Source and Security | FunnelSlayer

Dask

Published by eyadsibai in ltk

No known issues62 installs

What this skill does

Use when "Dask", "parallel computing", "distributed computing", "larger than memory", or asking about "parallel pandas", "parallel numpy", "out-of-core", "multi-file processing", "cluster computing", "lazy evaluation dataframe

Add Dask to your agent

Review the source and files first. When you are ready, copy the prompt instruction or use the CLI command supported by your environment.

Install with a prompt

Paste this into a compatible coding agent:

add this skill "dask" from https://github.com/eyadsibai/ltk

Install with the CLI

Run this command in a controlled environment after reviewing the repository:

npx skills add https://github.com/eyadsibai/ltk --skill dask

Skill instructions

Dask Parallel and Distributed Computing

Scale pandas/NumPy workflows beyond memory and across clusters.

When to Use

  • Datasets exceed available RAM
  • Need to parallelize pandas or NumPy operations
  • Processing multiple files efficiently (CSVs, Parquet)
  • Building custom parallel workflows
  • Distributing workloads across multiple cores/machines

Dask Collections

CollectionLikeUse Case
DataFramepandasTabular data, CSV/Parquet
ArrayNumPyNumerical arrays, matrices
BaglistUnstructured data, JSON logs
DelayedCustomArbitrary Python functions

Key concept: All collections are lazy—computation happens only when you call .compute().


Lazy Evaluation

FunctionBehaviorUse
dd.read_csv()Lazy loadLarge CSVs
dd.read_parquet()Lazy loadLarge Parquet
OperationsBuild graphChain transforms
.compute()ExecuteGet final result

Key concept: Dask builds a task graph of operations, optimizes it, then executes in parallel. Call .compute() once at the end, not after every operation.


Schedulers

SchedulerBest ForStart
threadedNumPy/Pandas (releases GIL)Default
processesPure Python (GIL bound)scheduler='processes'
synchronousDebuggingscheduler='synchronous'
distributedMonitoring, scaling, clustersClient()

Distributed Scheduler

FeatureBenefit
DashboardReal-time progress monitoring
Cluster scalingAdd/remove workers
Fault toleranceRetry failed tasks
Worker resourcesMemory management

Chunking Concepts

DataFrame Partitions

ConceptDescription
PartitionSubset of rows (like a mini DataFrame)
npartitionsNumber of partitions
divisionsIndex boundaries between partitions

Array Chunks

ConceptDescription
ChunkSubset of array (n-dimensional block)
chunksTuple of chunk sizes per dimension
Optimal size~100 MB per chunk

Key concept: Chunk size is critical. Too small = scheduling overhead. Too large = memory issues. Target ~100 MB.


DataFrame Operations

Supported (parallel)

CategoryOperations
Selectionfilter, loc, column selection
Aggregationgroupby, sum, mean, count
Transformsapply (row-wise), map_partitions
Joinsmerge, join (shuffles data)
I/Oread_csv, read_parquet, to_parquet

Avoid or Use Carefully

OperationIssueAlternative
iterrowsKills parallelismmap_partitions
apply(axis=1)Slowmap_partitions
Repeated compute()InefficientSingle compute() at end
sort_valuesExpensive shuffleAvoid if possible

Common Patterns

ETL Pipeline

  1. scan_* or read_* (lazy load)
  2. Chain filters and transforms
  3. Single .compute() or .to_parquet()

Multi-File Processing

PatternDescription
Glob patternsdd.read_csv('data/*.csv')
Partition per fileNatural parallelism
Output partitionedto_parquet('output/')

Custom Operations

MethodUse Case
map_partitionsApply function to each partition
map_blocksApply function to each array block
delayedWrap arbitrary Python functions

Best Practices

PracticeWhy
Don't load locally firstLet Dask handle loading
Single compute() at endAvoid redundant computation
Use ParquetFaster than CSV, columnar
Match partition to filesOne partition per file
Check task graph sizelen(ddf.__dask_graph__()) < 100k
Use distributed for debuggingDashboard shows progress

Common Pitfalls

PitfallSolution
Loading with pandas firstUse dd.read_* directly
compute() in loopsCollect all, single compute()
Too many partitionsRepartition to ~100 MB each
Memory errorsReduce chunk size, add workers
Slow shufflesAvoid sorts/joins when possible

vs Alternatives

ToolBest ForTrade-off
DaskScale pandas/NumPy, clustersSetup complexity
PolarsFast in-memoryMust fit in RAM
VaexOut-of-core single machineLimited operations
SparkEnterprise, SQL-heavyInfrastructure

Resources

Files included

  • SKILL.md

More skills