[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6J9HZ64H7MXWVZGMBRAYZP7":3,"skill-same:01M6J9HZ64H7MXWVZGMBRAYZP7":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":26,"publishedAt":50,"linkOnly":51,"markdownContent":52,"markdownBody":53,"frontMatter":54,"refName":64,"commitSha":65,"skillDirectory":66,"forksCount":58,"repositoryHtmlUrl":67,"repositoryHomepageUrl":6,"ownerHtmlUrl":68,"ownerBlogUrl":69,"ownerDescription":70,"updatedAt":71,"install":72,"resources":84},"01M6J9HZ64H7MXWVZGMBRAYZP7","science-dask",null,"Distributed computing for larger-than-RAM pandas\u002FNumPy workflows. Use when you need to scale existing pandas\u002FNumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.","Flissel\u002Fvibemind-os","Flissel","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F104565236?v=4","01M6J8Q88NWAJGKPC5TEG9YCNV","Felix Baumann","01M6J8Q8D7XAFY44P70XTJFZBW",1,"MIT","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fskills\u002Fscience\u002Fdask\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000013","分析与可视化","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49],"science dask","dask","science","repo","Clusters","2026","when","source","for","you","processing","machine","across","imported","memory","parallel","vaex","pandas","polars","code","core","analytics","workflows","2026-11-10 10:12:30",false,"---\nname: science-dask\ndescription: Distributed computing for larger-than-RAM pandas\u002FNumPy workflows. Use\n  when you need to scale existing pandas\u002FNumPy code beyond memory or across clusters.\n  Best for parallel file processing, distributed ML, integration with existing pandas\n  code. For out-of-core analytics on single machine use vaex; for in-memory speed\n  use polars.\napp: science\nrequires_approval: true\nagents:\n- '*'\ninputs: []\nexpected_state:\n  description: Imported skill — behavior matches source repo\n  verification_tool: none\nconfidence: 1.0\nattempts: 0\nsuccesses: 0\nlast_adjusted: '2026-05-11T21:21:43+00:00'\n---\n\n# Dask\n\n## Overview\n\nDask is a Python library for parallel and distributed computing that enables three critical capabilities:\n- **Larger-than-memory execution** on single machines for data exceeding available RAM\n- **Parallel processing** for improved computational speed across multiple cores\n- **Distributed computation** supporting terabyte-scale datasets across multiple machines\n\nDask scales from laptops (processing ~100 GiB) to clusters (processing ~100 TiB) while maintaining familiar Python APIs.\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Process datasets that exceed available RAM\n- Scale pandas or NumPy operations to larger datasets\n- Parallelize computations for performance improvements\n- Process multiple files efficiently (CSVs, Parquet, JSON, text logs)\n- Build custom parallel workflows with task dependencies\n- Distribute workloads across multiple cores or machines\n\n## Core Capabilities\n\nDask provides five main components, each suited to different use cases:\n\n### 1. DataFrames - Parallel Pandas Operations\n\n**Purpose**: Scale pandas operations to larger datasets through parallel processing.\n\n**When to Use**:\n- Tabular data exceeds available RAM\n- Need to process multiple CSV\u002FParquet files together\n- Pandas operations are slow and need parallelization\n- Scaling from pandas prototype to production\n\n**Reference Documentation**: For comprehensive guidance on Dask DataFrames, refer to `references\u002Fdataframes.md` which includes:\n- Reading data (single files, multiple files, glob patterns)\n- Common operations (filtering, groupby, joins, aggregations)\n- Custom operations with `map_partitions`\n- Performance optimization tips\n- Common patterns (ETL, time series, multi-file processing)\n\n**Quick Example**:\n```python\nimport dask.dataframe as dd\n\n# Read multiple files as single DataFrame\nddf = dd.read_csv('data\u002F2024-*.csv')\n\n# Operations are lazy until compute()\nfiltered = ddf[ddf['value'] > 100]\nresult = filtered.groupby('category').mean().compute()\n```\n\n**Key Points**:\n- Operations are lazy (build task graph) until `.compute()` called\n- Use `map_partitions` for efficient custom operations\n- Convert to DataFrame early when working with structured data from other sources\n\n### 2. Arrays - Parallel NumPy Operations\n\n**Purpose**: Extend NumPy capabilities to datasets larger than memory using blocked algorithms.\n\n**When to Use**:\n- Arrays exceed available RAM\n- NumPy operations need parallelization\n- Working with scientific datasets (HDF5, Zarr, NetCDF)\n- Need parallel linear algebra or array operations\n\n**Reference Documentation**: For comprehensive guidance on Dask Arrays, refer to `references\u002Farrays.md` which includes:\n- Creating arrays (from NumPy, random, from disk)\n- Chunking strategies and optimization\n- Common operations (arithmetic, reductions, linear algebra)\n- Custom operations with `map_blocks`\n- Integration with HDF5, Zarr, and XArray\n\n**Quick Example**:\n```python\nimport dask.array as da\n\n# Create large array with chunks\nx = da.random.random((100000, 100000), chunks=(10000, 10000))\n\n# Operations are lazy\ny = x + 100\nz = y.mean(axis=0)\n\n# Compute result\nresult = z.compute()\n```\n\n**Key Points**:\n- Chunk size is critical (aim for ~100 MB per chunk)\n- Operations work on chunks in parallel\n- Rechunk data when needed for efficient operations\n- Use `map_blocks` for operations not available in Dask\n\n### 3. Bags - Parallel Processing of Unstructured Data\n\n**Purpose**: Process unstructured or semi-structured data (text, JSON, logs) with functional operations.\n\n**When to Use**:\n- Processing text files, logs, or JSON records\n- Data cleaning and ETL before structured analysis\n- Working with Python objects that don't fit array\u002Fdataframe formats\n- Need memory-efficient streaming processing\n\n**Reference Documentation**: For comprehensive guidance on Dask Bags, refer to `references\u002Fbags.md` which includes:\n- Reading text and JSON files\n- Functional operations (map, filter, fold, groupby)\n- Converting to DataFrames\n- Common patterns (log analysis, JSON processing, text processing)\n- Performance considerations\n\n**Quick Example**:\n```python\nimport dask.bag as db\nimport json\n\n# Read and parse JSON files\nbag = db.read_text('logs\u002F*.json').map(json.loads)\n\n# Filter and transform\nvalid = bag.filter(lambda x: x['status'] == 'valid')\nprocessed = valid.map(lambda x: {'id': x['id'], 'value': x['value']})\n\n# Convert to DataFrame for analysis\nddf = processed.to_dataframe()\n```\n\n**Key Points**:\n- Use for initial data cleaning, then convert to DataFrame\u002FArray\n- Use `foldby` instead of `groupby` for better performance\n- Operations are streaming and memory-efficient\n- Convert to structured formats (DataFrame) for complex operations\n\n### 4. Futures - Task-Based Parallelization\n\n**Purpose**: Build custom parallel workflows with fine-grained control over task execution and dependencies.\n\n**When to Use**:\n- Building dynamic, evolving workflows\n- Need immediate task execution (not lazy)\n- Computations depend on runtime conditions\n- Implementing custom parallel algorithms\n- Need stateful computations\n\n**Reference Documentation**: For comprehensive guidance on Dask Futures, refer to `references\u002Ffutures.md` which includes:\n- Setting up distributed client\n- Submitting tasks and working with futures\n- Task dependencies and data movement\n- Advanced coordination (queues, locks, events, actors)\n- Common patterns (parameter sweeps, dynamic tasks, iterative algorithms)\n\n**Quick Example**:\n```python\nfrom dask.distributed import Client\n\nclient = Client()  # Create local cluster\n\n# Submit tasks (executes immediately)\ndef process(x):\n    return x ** 2\n\nfutures = client.map(process, range(100))\n\n# Gather results\nresults = client.gather(futures)\n\nclient.close()\n```\n\n**Key Points**:\n- Requires distributed client (even for single machine)\n- Tasks execute immediately when submitted\n- Pre-scatter large data to avoid repeated transfers\n- ~1ms overhead per task (not suitable for millions of tiny tasks)\n- Use actors for stateful workflows\n\n### 5. Schedulers - Execution Backends\n\n**Purpose**: Control how and where Dask tasks execute (threads, processes, distributed).\n\n**When to Choose Scheduler**:\n- **Threads** (default): NumPy\u002FPandas operations, GIL-releasing libraries, shared memory benefit\n- **Processes**: Pure Python code, text processing, GIL-bound operations\n- **Synchronous**: Debugging with pdb, profiling, understanding errors\n- **Distributed**: Need dashboard, multi-machine clusters, advanced features\n\n**Reference Documentation**: For comprehensive guidance on Dask Schedulers, refer to `references\u002Fschedulers.md` which includes:\n- Detailed scheduler descriptions and characteristics\n- Configuration methods (global, context manager, per-compute)\n- Performance considerations and overhead\n- Common patterns and troubleshooting\n- Thread configuration for optimal performance\n\n**Quick Example**:\n```python\nimport dask\nimport dask.dataframe as dd\n\n# Use threads for DataFrame (default, good for numeric)\nddf = dd.read_csv('data.csv')\nresult1 = ddf.mean().compute()  # Uses threads\n\n# Use processes for Python-heavy work\nimport dask.bag as db\nbag = db.read_text('logs\u002F*.txt')\nresult2 = bag.map(python_function).compute(scheduler='processes')\n\n# Use synchronous for debugging\ndask.config.set(scheduler='synchronous')\nresult3 = problematic_computation.compute()  # Can use pdb\n\n# Use distributed for monitoring and scaling\nfrom dask.distributed import Client\nclient = Client()\nresult4 = computation.compute()  # Uses distributed with dashboard\n```\n\n**Key Points**:\n- Threads: Lowest overhead (~10 µs\u002Ftask), best for numeric work\n- Processes: Avoids GIL (~10 ms\u002Ftask), best for Python work\n- Distributed: Monitoring dashboard (~1 ms\u002Ftask), scales to clusters\n- Can switch schedulers per computation or globally\n\n## Best Practices\n\nFor comprehensive performance optimization guidance, memory management strategies, and common pitfalls to avoid, refer to `references\u002Fbest-practices.md`. Key principles include:\n\n### Start with Simpler Solutions\nBefore using Dask, explore:\n- Better algorithms\n- Efficient file formats (Parquet instead of CSV)\n- Compiled code (Numba, Cython)\n- Data sampling\n\n### Critical Performance Rules\n\n**1. Don't Load Data Locally Then Hand to Dask**\n```python\n# Wrong: Loads all data in memory first\nimport pandas as pd\ndf = pd.read_csv('large.csv')\nddf = dd.from_pandas(df, npartitions=10)\n\n# Correct: Let Dask handle loading\nimport dask.dataframe as dd\nddf = dd.read_csv('large.csv')\n```\n\n**2. Avoid Repeated compute() Calls**\n```python\n# Wrong: Each compute is separate\nfor item in items:\n    result = dask_computation(item).compute()\n\n# Correct: Single compute for all\ncomputations = [dask_computation(item) for item in items]\nresults = dask.compute(*computations)\n```\n\n**3. Don't Build Excessively Large Task Graphs**\n- Increase chunk sizes if millions of tasks\n- Use `map_partitions`\u002F`map_blocks` to fuse operations\n- Check task graph size: `len(ddf.__dask_graph__())`\n\n**4. Choose Appropriate Chunk Sizes**\n- Target: ~100 MB per chunk (or 10 chunks per core in worker memory)\n- Too large: Memory overflow\n- Too small: Scheduling overhead\n\n**5. Use the Dashboard**\n```python\nfrom dask.distributed import Client\nclient = Client()\nprint(client.dashboard_link)  # Monitor performance, identify bottlenecks\n```\n\n## Common Workflow Patterns\n\n### ETL Pipeline\n```python\nimport dask.dataframe as dd\n\n# Extract: Read data\nddf = dd.read_csv('raw_data\u002F*.csv')\n\n# Transform: Clean and process\nddf = ddf[ddf['status'] == 'valid']\nddf['amount'] = ddf['amount'].astype('float64')\nddf = ddf.dropna(subset=['important_col'])\n\n# Load: Aggregate and save\nsummary = ddf.groupby('category').agg({'amount': ['sum', 'mean']})\nsummary.to_parquet('output\u002Fsummary.parquet')\n```\n\n### Unstructured to Structured Pipeline\n```python\nimport dask.bag as db\nimport json\n\n# Start with Bag for unstructured data\nbag = db.read_text('logs\u002F*.json').map(json.loads)\nbag = bag.filter(lambda x: x['status'] == 'valid')\n\n# Convert to DataFrame for structured analysis\nddf = bag.to_dataframe()\nresult = ddf.groupby('category').mean().compute()\n```\n\n### Large-Scale Array Computation\n```python\nimport dask.array as da\n\n# Load or create large array\nx = da.from_zarr('large_dataset.zarr')\n\n# Process in chunks\nnormalized = (x - x.mean()) \u002F x.std()\n\n# Save result\nda.to_zarr(normalized, 'normalized.zarr')\n```\n\n### Custom Parallel Workflow\n```python\nfrom dask.distributed import Client\n\nclient = Client()\n\n# Scatter large dataset once\ndata = client.scatter(large_dataset)\n\n# Process in parallel with dependencies\nfutures = []\nfor param in parameters:\n    future = client.submit(process, data, param)\n    futures.append(future)\n\n# Gather results\nresults = client.gather(futures)\n```\n\n## Selecting the Right Component\n\nUse this decision guide to choose the appropriate Dask component:\n\n**Data Type**:\n- Tabular data → **DataFrames**\n- Numeric arrays → **Arrays**\n- Text\u002FJSON\u002Flogs → **Bags** (then convert to DataFrame)\n- Custom Python objects → **Bags** or **Futures**\n\n**Operation Type**:\n- Standard pandas operations → **DataFrames**\n- Standard NumPy operations → **Arrays**\n- Custom parallel tasks → **Futures**\n- Text processing\u002FETL → **Bags**\n\n**Control Level**:\n- High-level, automatic → **DataFrames\u002FArrays**\n- Low-level, manual → **Futures**\n\n**Workflow Type**:\n- Static computation graph → **DataFrames\u002FArrays\u002FBags**\n- Dynamic, evolving → **Futures**\n\n## Integration Considerations\n\n### File Formats\n- **Efficient**: Parquet, HDF5, Zarr (columnar, compressed, parallel-friendly)\n- **Compatible but slower**: CSV (use for initial ingestion only)\n- **For Arrays**: HDF5, Zarr, NetCDF\n\n### Conversion Between Collections\n```python\n# Bag → DataFrame\nddf = bag.to_dataframe()\n\n# DataFrame → Array (for numeric data)\narr = ddf.to_dask_array(lengths=True)\n\n# Array → DataFrame\nddf = dd.from_dask_array(arr, columns=['col1', 'col2'])\n```\n\n### With Other Libraries\n- **XArray**: Wraps Dask arrays with labeled dimensions (geospatial, imaging)\n- **Dask-ML**: Machine learning with scikit-learn compatible APIs\n- **Distributed**: Advanced cluster management and monitoring\n\n## Debugging and Development\n\n### Iterative Development Workflow\n\n1. **Test on small data with synchronous scheduler**:\n```python\ndask.config.set(scheduler='synchronous')\nresult = computation.compute()  # Can use pdb, easy debugging\n```\n\n2. **Validate with threads on sample**:\n```python\nsample = ddf.head(1000)  # Small sample\n# Test logic, then scale to full dataset\n```\n\n3. **Scale with distributed for monitoring**:\n```python\nfrom dask.distributed import Client\nclient = Client()\nprint(client.dashboard_link)  # Monitor performance\nresult = computation.compute()\n```\n\n### Common Issues\n\n**Memory Errors**:\n- Decrease chunk sizes\n- Use `persist()` strategically and delete when done\n- Check for memory leaks in custom functions\n\n**Slow Start**:\n- Task graph too large (increase chunk sizes)\n- Use `map_partitions` or `map_blocks` to reduce tasks\n\n**Poor Parallelization**:\n- Chunks too large (increase number of partitions)\n- Using threads with Python code (switch to processes)\n- Data dependencies preventing parallelism\n\n## Reference Files\n\nAll reference documentation files can be read as needed for detailed information:\n\n- `references\u002Fdataframes.md` - Complete Dask DataFrame guide\n- `references\u002Farrays.md` - Complete Dask Array guide\n- `references\u002Fbags.md` - Complete Dask Bag guide\n- `references\u002Ffutures.md` - Complete Dask Futures and distributed computing guide\n- `references\u002Fschedulers.md` - Complete scheduler selection and configuration guide\n- `references\u002Fbest-practices.md` - Comprehensive performance optimization and troubleshooting\n\nLoad these files when users need detailed information about specific Dask components, operations, or patterns beyond the quick guidance provided here.\n\n","# Dask\n\n## Overview\n\nDask is a Python library for parallel and distributed computing that enables three critical capabilities:\n- **Larger-than-memory execution** on single machines for data exceeding available RAM\n- **Parallel processing** for improved computational speed across multiple cores\n- **Distributed computation** supporting terabyte-scale datasets across multiple machines\n\nDask scales from laptops (processing ~100 GiB) to clusters (processing ~100 TiB) while maintaining familiar Python APIs.\n\n## When to Use This Skill\n\nThis skill should be used when:\n- Process datasets that exceed available RAM\n- Scale pandas or NumPy operations to larger datasets\n- Parallelize computations for performance improvements\n- Process multiple files efficiently (CSVs, Parquet, JSON, text logs)\n- Build custom parallel workflows with task dependencies\n- Distribute workloads across multiple cores or machines\n\n## Core Capabilities\n\nDask provides five main components, each suited to different use cases:\n\n### 1. DataFrames - Parallel Pandas Operations\n\n**Purpose**: Scale pandas operations to larger datasets through parallel processing.\n\n**When to Use**:\n- Tabular data exceeds available RAM\n- Need to process multiple CSV\u002FParquet files together\n- Pandas operations are slow and need parallelization\n- Scaling from pandas prototype to production\n\n**Reference Documentation**: For comprehensive guidance on Dask DataFrames, refer to `references\u002Fdataframes.md` which includes:\n- Reading data (single files, multiple files, glob patterns)\n- Common operations (filtering, groupby, joins, aggregations)\n- Custom operations with `map_partitions`\n- Performance optimization tips\n- Common patterns (ETL, time series, multi-file processing)\n\n**Quick Example**:\n```python\nimport dask.dataframe as dd\n\n# Read multiple files as single DataFrame\nddf = dd.read_csv('data\u002F2024-*.csv')\n\n# Operations are lazy until compute()\nfiltered = ddf[ddf['value'] > 100]\nresult = filtered.groupby('category').mean().compute()\n```\n\n**Key Points**:\n- Operations are lazy (build task graph) until `.compute()` called\n- Use `map_partitions` for efficient custom operations\n- Convert to DataFrame early when working with structured data from other sources\n\n### 2. Arrays - Parallel NumPy Operations\n\n**Purpose**: Extend NumPy capabilities to datasets larger than memory using blocked algorithms.\n\n**When to Use**:\n- Arrays exceed available RAM\n- NumPy operations need parallelization\n- Working with scientific datasets (HDF5, Zarr, NetCDF)\n- Need parallel linear algebra or array operations\n\n**Reference Documentation**: For comprehensive guidance on Dask Arrays, refer to `references\u002Farrays.md` which includes:\n- Creating arrays (from NumPy, random, from disk)\n- Chunking strategies and optimization\n- Common operations (arithmetic, reductions, linear algebra)\n- Custom operations with `map_blocks`\n- Integration with HDF5, Zarr, and XArray\n\n**Quick Example**:\n```python\nimport dask.array as da\n\n# Create large array with chunks\nx = da.random.random((100000, 100000), chunks=(10000, 10000))\n\n# Operations are lazy\ny = x + 100\nz = y.mean(axis=0)\n\n# Compute result\nresult = z.compute()\n```\n\n**Key Points**:\n- Chunk size is critical (aim for ~100 MB per chunk)\n- Operations work on chunks in parallel\n- Rechunk data when needed for efficient operations\n- Use `map_blocks` for operations not available in Dask\n\n### 3. Bags - Parallel Processing of Unstructured Data\n\n**Purpose**: Process unstructured or semi-structured data (text, JSON, logs) with functional operations.\n\n**When to Use**:\n- Processing text files, logs, or JSON records\n- Data cleaning and ETL before structured analysis\n- Working with Python objects that don't fit array\u002Fdataframe formats\n- Need memory-efficient streaming processing\n\n**Reference Documentation**: For comprehensive guidance on Dask Bags, refer to `references\u002Fbags.md` which includes:\n- Reading text and JSON files\n- Functional operations (map, filter, fold, groupby)\n- Converting to DataFrames\n- Common patterns (log analysis, JSON processing, text processing)\n- Performance considerations\n\n**Quick Example**:\n```python\nimport dask.bag as db\nimport json\n\n# Read and parse JSON files\nbag = db.read_text('logs\u002F*.json').map(json.loads)\n\n# Filter and transform\nvalid = bag.filter(lambda x: x['status'] == 'valid')\nprocessed = valid.map(lambda x: {'id': x['id'], 'value': x['value']})\n\n# Convert to DataFrame for analysis\nddf = processed.to_dataframe()\n```\n\n**Key Points**:\n- Use for initial data cleaning, then convert to DataFrame\u002FArray\n- Use `foldby` instead of `groupby` for better performance\n- Operations are streaming and memory-efficient\n- Convert to structured formats (DataFrame) for complex operations\n\n### 4. Futures - Task-Based Parallelization\n\n**Purpose**: Build custom parallel workflows with fine-grained control over task execution and dependencies.\n\n**When to Use**:\n- Building dynamic, evolving workflows\n- Need immediate task execution (not lazy)\n- Computations depend on runtime conditions\n- Implementing custom parallel algorithms\n- Need stateful computations\n\n**Reference Documentation**: For comprehensive guidance on Dask Futures, refer to `references\u002Ffutures.md` which includes:\n- Setting up distributed client\n- Submitting tasks and working with futures\n- Task dependencies and data movement\n- Advanced coordination (queues, locks, events, actors)\n- Common patterns (parameter sweeps, dynamic tasks, iterative algorithms)\n\n**Quick Example**:\n```python\nfrom dask.distributed import Client\n\nclient = Client()  # Create local cluster\n\n# Submit tasks (executes immediately)\ndef process(x):\n    return x ** 2\n\nfutures = client.map(process, range(100))\n\n# Gather results\nresults = client.gather(futures)\n\nclient.close()\n```\n\n**Key Points**:\n- Requires distributed client (even for single machine)\n- Tasks execute immediately when submitted\n- Pre-scatter large data to avoid repeated transfers\n- ~1ms overhead per task (not suitable for millions of tiny tasks)\n- Use actors for stateful workflows\n\n### 5. Schedulers - Execution Backends\n\n**Purpose**: Control how and where Dask tasks execute (threads, processes, distributed).\n\n**When to Choose Scheduler**:\n- **Threads** (default): NumPy\u002FPandas operations, GIL-releasing libraries, shared memory benefit\n- **Processes**: Pure Python code, text processing, GIL-bound operations\n- **Synchronous**: Debugging with pdb, profiling, understanding errors\n- **Distributed**: Need dashboard, multi-machine clusters, advanced features\n\n**Reference Documentation**: For comprehensive guidance on Dask Schedulers, refer to `references\u002Fschedulers.md` which includes:\n- Detailed scheduler descriptions and characteristics\n- Configuration methods (global, context manager, per-compute)\n- Performance considerations and overhead\n- Common patterns and troubleshooting\n- Thread configuration for optimal performance\n\n**Quick Example**:\n```python\nimport dask\nimport dask.dataframe as dd\n\n# Use threads for DataFrame (default, good for numeric)\nddf = dd.read_csv('data.csv')\nresult1 = ddf.mean().compute()  # Uses threads\n\n# Use processes for Python-heavy work\nimport dask.bag as db\nbag = db.read_text('logs\u002F*.txt')\nresult2 = bag.map(python_function).compute(scheduler='processes')\n\n# Use synchronous for debugging\ndask.config.set(scheduler='synchronous')\nresult3 = problematic_computation.compute()  # Can use pdb\n\n# Use distributed for monitoring and scaling\nfrom dask.distributed import Client\nclient = Client()\nresult4 = computation.compute()  # Uses distributed with dashboard\n```\n\n**Key Points**:\n- Threads: Lowest overhead (~10 µs\u002Ftask), best for numeric work\n- Processes: Avoids GIL (~10 ms\u002Ftask), best for Python work\n- Distributed: Monitoring dashboard (~1 ms\u002Ftask), scales to clusters\n- Can switch schedulers per computation or globally\n\n## Best Practices\n\nFor comprehensive performance optimization guidance, memory management strategies, and common pitfalls to avoid, refer to `references\u002Fbest-practices.md`. Key principles include:\n\n### Start with Simpler Solutions\nBefore using Dask, explore:\n- Better algorithms\n- Efficient file formats (Parquet instead of CSV)\n- Compiled code (Numba, Cython)\n- Data sampling\n\n### Critical Performance Rules\n\n**1. Don't Load Data Locally Then Hand to Dask**\n```python\n# Wrong: Loads all data in memory first\nimport pandas as pd\ndf = pd.read_csv('large.csv')\nddf = dd.from_pandas(df, npartitions=10)\n\n# Correct: Let Dask handle loading\nimport dask.dataframe as dd\nddf = dd.read_csv('large.csv')\n```\n\n**2. Avoid Repeated compute() Calls**\n```python\n# Wrong: Each compute is separate\nfor item in items:\n    result = dask_computation(item).compute()\n\n# Correct: Single compute for all\ncomputations = [dask_computation(item) for item in items]\nresults = dask.compute(*computations)\n```\n\n**3. Don't Build Excessively Large Task Graphs**\n- Increase chunk sizes if millions of tasks\n- Use `map_partitions`\u002F`map_blocks` to fuse operations\n- Check task graph size: `len(ddf.__dask_graph__())`\n\n**4. Choose Appropriate Chunk Sizes**\n- Target: ~100 MB per chunk (or 10 chunks per core in worker memory)\n- Too large: Memory overflow\n- Too small: Scheduling overhead\n\n**5. Use the Dashboard**\n```python\nfrom dask.distributed import Client\nclient = Client()\nprint(client.dashboard_link)  # Monitor performance, identify bottlenecks\n```\n\n## Common Workflow Patterns\n\n### ETL Pipeline\n```python\nimport dask.dataframe as dd\n\n# Extract: Read data\nddf = dd.read_csv('raw_data\u002F*.csv')\n\n# Transform: Clean and process\nddf = ddf[ddf['status'] == 'valid']\nddf['amount'] = ddf['amount'].astype('float64')\nddf = ddf.dropna(subset=['important_col'])\n\n# Load: Aggregate and save\nsummary = ddf.groupby('category').agg({'amount': ['sum', 'mean']})\nsummary.to_parquet('output\u002Fsummary.parquet')\n```\n\n### Unstructured to Structured Pipeline\n```python\nimport dask.bag as db\nimport json\n\n# Start with Bag for unstructured data\nbag = db.read_text('logs\u002F*.json').map(json.loads)\nbag = bag.filter(lambda x: x['status'] == 'valid')\n\n# Convert to DataFrame for structured analysis\nddf = bag.to_dataframe()\nresult = ddf.groupby('category').mean().compute()\n```\n\n### Large-Scale Array Computation\n```python\nimport dask.array as da\n\n# Load or create large array\nx = da.from_zarr('large_dataset.zarr')\n\n# Process in chunks\nnormalized = (x - x.mean()) \u002F x.std()\n\n# Save result\nda.to_zarr(normalized, 'normalized.zarr')\n```\n\n### Custom Parallel Workflow\n```python\nfrom dask.distributed import Client\n\nclient = Client()\n\n# Scatter large dataset once\ndata = client.scatter(large_dataset)\n\n# Process in parallel with dependencies\nfutures = []\nfor param in parameters:\n    future = client.submit(process, data, param)\n    futures.append(future)\n\n# Gather results\nresults = client.gather(futures)\n```\n\n## Selecting the Right Component\n\nUse this decision guide to choose the appropriate Dask component:\n\n**Data Type**:\n- Tabular data → **DataFrames**\n- Numeric arrays → **Arrays**\n- Text\u002FJSON\u002Flogs → **Bags** (then convert to DataFrame)\n- Custom Python objects → **Bags** or **Futures**\n\n**Operation Type**:\n- Standard pandas operations → **DataFrames**\n- Standard NumPy operations → **Arrays**\n- Custom parallel tasks → **Futures**\n- Text processing\u002FETL → **Bags**\n\n**Control Level**:\n- High-level, automatic → **DataFrames\u002FArrays**\n- Low-level, manual → **Futures**\n\n**Workflow Type**:\n- Static computation graph → **DataFrames\u002FArrays\u002FBags**\n- Dynamic, evolving → **Futures**\n\n## Integration Considerations\n\n### File Formats\n- **Efficient**: Parquet, HDF5, Zarr (columnar, compressed, parallel-friendly)\n- **Compatible but slower**: CSV (use for initial ingestion only)\n- **For Arrays**: HDF5, Zarr, NetCDF\n\n### Conversion Between Collections\n```python\n# Bag → DataFrame\nddf = bag.to_dataframe()\n\n# DataFrame → Array (for numeric data)\narr = ddf.to_dask_array(lengths=True)\n\n# Array → DataFrame\nddf = dd.from_dask_array(arr, columns=['col1', 'col2'])\n```\n\n### With Other Libraries\n- **XArray**: Wraps Dask arrays with labeled dimensions (geospatial, imaging)\n- **Dask-ML**: Machine learning with scikit-learn compatible APIs\n- **Distributed**: Advanced cluster management and monitoring\n\n## Debugging and Development\n\n### Iterative Development Workflow\n\n1. **Test on small data with synchronous scheduler**:\n```python\ndask.config.set(scheduler='synchronous')\nresult = computation.compute()  # Can use pdb, easy debugging\n```\n\n2. **Validate with threads on sample**:\n```python\nsample = ddf.head(1000)  # Small sample\n# Test logic, then scale to full dataset\n```\n\n3. **Scale with distributed for monitoring**:\n```python\nfrom dask.distributed import Client\nclient = Client()\nprint(client.dashboard_link)  # Monitor performance\nresult = computation.compute()\n```\n\n### Common Issues\n\n**Memory Errors**:\n- Decrease chunk sizes\n- Use `persist()` strategically and delete when done\n- Check for memory leaks in custom functions\n\n**Slow Start**:\n- Task graph too large (increase chunk sizes)\n- Use `map_partitions` or `map_blocks` to reduce tasks\n\n**Poor Parallelization**:\n- Chunks too large (increase number of partitions)\n- Using threads with Python code (switch to processes)\n- Data dependencies preventing parallelism\n\n## Reference Files\n\nAll reference documentation files can be read as needed for detailed information:\n\n- `references\u002Fdataframes.md` - Complete Dask DataFrame guide\n- `references\u002Farrays.md` - Complete Dask Array guide\n- `references\u002Fbags.md` - Complete Dask Bag guide\n- `references\u002Ffutures.md` - Complete Dask Futures and distributed computing guide\n- `references\u002Fschedulers.md` - Complete scheduler selection and configuration guide\n- `references\u002Fbest-practices.md` - Comprehensive performance optimization and troubleshooting\n\nLoad these files when users need detailed information about specific Dask components, operations, or patterns beyond the quick guidance provided here.\n\n",{"app":29,"name":5,"agents":55,"inputs":57,"attempts":58,"successes":58,"confidence":14,"description":7,"last_adjusted":59,"expected_state":60,"requires_approval":63},[56],"*",[],0,"2026-05-11T21:21:43+00:00",{"description":61,"verification_tool":62},"Imported skill — behavior matches source repo","none",true,"master","5f13b5d2b532c0ab6f847e3aa24d4bfe66f7d461","skills\u002Fscience\u002Fdask","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os","https:\u002F\u002Fgithub.com\u002FFlissel","https:\u002F\u002Fvibemind.space","Co-founder & CTO, VibeMind - a voice-first agentic OS for non-technical founders. Agents that do the work, not describe it.","2026-11-13 01:43:48",{"source":8,"skillName":5,"commands":73,"prompt":83,"zipAvailable":63},[74,77,80],{"tool":75,"command":76},"npx","npx skills add Flissel\u002Fvibemind-os --skill science-dask",{"tool":78,"command":79},"bunx","bunx skills add Flissel\u002Fvibemind-os --skill science-dask",{"tool":81,"command":82},"pnpm","pnpm dlx skills add Flissel\u002Fvibemind-os --skill science-dask","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fskills\u002Fscience\u002Fdask\u002FSKILL.md",[],[86,94,101,129,137,151],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":50},"01M6JAA67M92TRE7GWDJDBTA9T","review","Review a change.","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fspaces\u002Frowboat\u002Frowboat\u002Fpackages\u002Fopenai-plugin-runtime\u002Ftest\u002Ffixtures\u002Fcomplete-plugin\u002Fskills\u002Freview\u002FSKILL.md",[],[88,93],"change",{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":50},"01M6JAA3DZR55G8ZY493BE9NBB","triage","Triage a change.","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fspaces\u002Frowboat\u002Frowboat\u002Fpackages\u002Fopenai-plugin-runtime\u002Ftest\u002Ffixtures\u002Fcomplete-plugin\u002Fskills\u002Fgroup\u002Ftriage\u002FSKILL.md",[],[96,93],{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":50},"01M6JA9XPVHENK0FQN7HBK54NV","zentrale-werkzeuge","Werkzeuge der Zentrale – nutzen bei GitHub-Fragen (Projekte updaten, Repos, Issues, PRs, Commits, CI\u002FActions-Status, README), bei Fragen zum eigenen Gitea (Sicherung\u002FSpiegel, Repos, Issues, Commits), wenn neueste Docs\u002FDoku zu einer Bibliothek oder einem Dienst geholt werden sollen, wenn ein Dashboard aus meinen Daten gebaut werden soll und wenn ich sage 'auf meinem PC suchen' oder 'such auf dem Rechner nach …'.","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fspaces\u002Frowboat\u002Fdeploy\u002Fheadless\u002Fskills\u002Fzentrale-werkzeuge\u002FSKILL.md",[],[108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128],"zentrale werkzeuge","grep","file","README","list","fetch","todo","gitea","add","URL","mkdir","prs","commits","ci","actions","issues","status","repos","dashboard","github","docs",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":50},"01M6JA9SQPX187CVC148SQT1SP","wissen-suchen","Bedeutungssuche im Rowboat-Wissen – IMMER zuerst nutzen, wenn nach Kunden, Kontakten, Themen, Interessen, Notizen oder 'was wissen wir über …' gefragt wird, besonders wenn die genauen Wörter unklar sind.","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fspaces\u002Frowboat\u002Fdeploy\u002Fheadless\u002Fskills\u002Fwissen-suchen\u002FSKILL.md",[],[136],"wissen suchen",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":50},"01M6JA9P6GNFPE21101SDZS3BT","reel-aus-material","Reel aus vorhandenen Laura-Videos: passende Stellen im Transkript finden; spricht dort eine Person, bleibt ihr Originalton (mit Untertiteln aus dem Transkript), sonst trägt ein eingesprochener Satz den Clip. Bei Aufträgen der Art 'material'.","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fspaces\u002Fmarketing\u002Fvideo_claw\u002Fskills\u002Freel-aus-material\u002FSKILL.md",[],[144,145,146,147,148,149,150],"material","reel","reel aus material","person","videos","Art","clip",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":155,"categories":156,"keywords":157,"publishedAt":50},"01M6JA9KSATRT42ACWT66514ZP","reel-aus-bildern","Reel ohne Filmmaterial: Titelkarte, 3–5 Markenbilder mit wechselnder Bewegung, Schlusskarte mit Handlung; Farben und Logo der Firma. Bei Aufträgen der Art 'bilder'.","https:\u002F\u002Fgithub.com\u002FFlissel\u002Fvibemind-os\u002Fblob\u002Fmaster\u002Fspaces\u002Fmarketing\u002Fvideo_claw\u002Fskills\u002Freel-aus-bildern\u002FSKILL.md",[],[145,158,159,149],"reel aus bildern","logo"]