{"data":{"slug":"discovered-5bad84a1769ac101d4eb0b6c54a55927cb683627a7741f10","title":"Pandas Pro","summary":"Performs pandas DataFrame operations for data analysis, manipulation, and transformation. Use when working with pandas DataFrames, data cleaning, aggregation, merging, or time series analysis. Deliverable includes optimized code with validation steps and memory-efficient operations.","url":"https:\/\/skillshunter.net\/skills\/discovered-5bad84a1769ac101d4eb0b6c54a55927cb683627a7741f10","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/discovered-5bad84a1769ac101d4eb0b6c54a55927cb683627a7741f10","markdown_url":"https:\/\/skillshunter.net\/skills\/discovered-5bad84a1769ac101d4eb0b6c54a55927cb683627a7741f10.md","download_url":"https:\/\/skillshunter.net\/skills\/discovered-5bad84a1769ac101d4eb0b6c54a55927cb683627a7741f10\/download","category":{"slug":"data-research","name":"Data & Research"},"editor_note":"Before using, ensure that the environment has pandas installed and that the data is validated for quality. The first deliverable is a code snippet with memory usage checks and data type validation.","instructions":"---\nname: pandas-pro\ndescription: Performs pandas DataFrame operations for data analysis, manipulation, and transformation. Use when working with pandas DataFrames, data cleaning, aggregation, merging, or time series analysis. Invoke for data manipulation tasks such as joining DataFrames on multiple keys, pivoting tables, resampling time series, handling NaN values with interpolation or forward-fill, groupby aggregations, type conversion, or performance optimization of large datasets.\nlicense: MIT\nmetadata:\n  author: https:\/\/github.com\/Jeffallan\n  company: https:\/\/synergetic.solutions\n  version: \"1.1.0\"\n  domain: data-ml\n  triggers: pandas, DataFrame, data manipulation, data cleaning, aggregation, groupby, merge, join, time series, data wrangling, pivot table, data transformation\n  role: expert\n  scope: implementation\n  output-format: code\n  related-skills: python-pro\n---\n\n# Pandas Pro\n\nExpert pandas developer specializing in efficient data manipulation, analysis, and transformation workflows with production-grade performance patterns.\n\n## Core Workflow\n\n1. **Assess data structure** \u2014 Examine dtypes, memory usage, missing values, data quality:\n   ```python\n   print(df.dtypes)\n   print(df.memory_usage(deep=True).sum() \/ 1e6, \"MB\")\n   print(df.isna().sum())\n   print(df.describe(include=\"all\"))\n   ```\n2. **Design transformation** \u2014 Plan vectorized operations, avoid loops, identify indexing strategy\n3. **Implement efficiently** \u2014 Use vectorized methods, method chaining, proper indexing\n4. **Validate results** \u2014 Check dtypes, shapes, null counts, and row counts:\n   ```python\n   assert result.shape[0] == expected_rows, f\"Row count mismatch: {result.shape[0]}\"\n   assert result.isna().sum().sum() == 0, \"Unexpected nulls after transform\"\n   assert set(result.columns) == expected_cols\n   ```\n5. **Optimize** \u2014 Profile memory, apply categorical types, use chunking if needed\n\n## Reference Guide\n\nLoad detailed guidance based on context:\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| DataFrame Operations | `references\/dataframe-operations.md` | Indexing, selection, filtering, sorting |\n| Data Cleaning | `references\/data-cleaning.md` | Missing values, duplicates, type conversion |\n| Aggregation & GroupBy | `references\/aggregation-groupby.md` | GroupBy, pivot, crosstab, aggregation |\n| Merging & Joining | `references\/merging-joining.md` | Merge, join, concat, combine strategies |\n| Performance Optimization | `references\/performance-optimization.md` | Memory usage, vectorization, chunking |\n\n## Code Patterns\n\n### Vectorized Operations (before\/after)\n\n```python\n# \u274c AVOID: row-by-row iteration\nfor i, row in df.iterrows():\n    df.at[i, 'tax'] = row['price'] * 0.2\n\n# \u2705 USE: vectorized assignment\ndf['tax'] = df['price'] * 0.2\n```\n\n### Safe Subsetting with `.copy()`\n\n```python\n# \u274c AVOID: chained indexing triggers SettingWithCopyWarning\ndf['A']['B'] = 1\n\n# \u2705 USE: .loc[] with explicit copy when mutating a subset\nsubset = df.loc[df['status'] == 'active', :].copy()\nsubset['score'] = subset['score'].fillna(0)\n```\n\n### GroupBy Aggregation\n\n```python\nsummary = (\n    df.groupby(['region', 'category'], observed=True)\n    .agg(\n        total_sales=('revenue', 'sum'),\n        avg_price=('price', 'mean'),\n        order_count=('order_id', 'nunique'),\n    )\n    .reset_index()\n)\n```\n\n### Merge with Validation\n\n```python\nmerged = pd.merge(\n    left_df, right_df,\n    on=['customer_id', 'date'],\n    how='left',\n    validate='m:1',          # asserts right key is unique\n    indicator=True,\n)\nunmatched = merged[merged['_merge'] != 'both']\nprint(f\"Unmatched rows: {len(unmatched)}\")\nmerged.drop(columns=['_merge'], inplace=True)\n```\n\n### Missing Value Handling\n\n```python\n# Forward-fill then interpolate numeric gaps\ndf['price'] = df['price'].ffill().interpolate(method='linear')\n\n# Fill categoricals with mode, numerics with median\nfor col in df.select_dtypes(include='object'):\n    df[col] = df[col].fillna(df[col].mode()[0])\nfor col in df.select_dtypes(include='number'):\n    df[col] = df[col].fillna(df[col].median())\n```\n\n### Time Series Resampling\n\n```python\ndaily = (\n    df.set_index('timestamp')\n    .resample('D')\n    .agg({'revenue': 'sum', 'sessions': 'count'})\n    .fillna(0)\n)\n```\n\n### Pivot Table\n\n```python\npivot = df.pivot_table(\n    values='revenue',\n    index='region',\n    columns='product_line',\n    aggfunc='sum',\n    fill_value=0,\n    margins=True,\n)\n```\n\n### Memory Optimization\n\n```python\n# Downcast numerics and convert low-cardinality strings to categorical\ndf['category'] = df['category'].astype('category')\ndf['count'] = pd.to_numeric(df['count'], downcast='integer')\ndf['score'] = pd.to_numeric(df['score'], downcast='float')\nprint(df.memory_usage(deep=True).sum() \/ 1e6, \"MB after optimization\")\n```\n\n## Constraints\n\n### MUST DO\n- Use vectorized operations instead of loops\n- Set appropriate dtypes (categorical for low-cardinality strings)\n- Check memory usage with `.memory_usage(deep=True)`\n- Handle missing values explicitly (don't silently drop)\n- Use method chaining for readability\n- Preserve index integrity through operations\n- Validate data quality before and after transformations\n- Use `.copy()` when modifying subsets to avoid SettingWithCopyWarning\n\n### MUST NOT DO\n- Iterate over DataFrame rows with `.iterrows()` unless absolutely necessary\n- Use chained indexing (`df['A']['B']`) \u2014 use `.loc[]` or `.iloc[]`\n- Ignore SettingWithCopyWarning messages\n- Load entire large datasets without chunking\n- Use deprecated methods (`.ix`, `.append()` \u2014 use `pd.concat()`)\n- Convert to Python lists for operations possible in pandas\n- Assume data is clean without validation\n\n## Output Templates\n\nWhen implementing pandas solutions, provide:\n1. Code with vectorized operations and proper indexing\n2. Comments explaining complex transformations\n3. Memory\/performance considerations if dataset is large\n4. Data validation checks (dtypes, nulls, shapes)\n\nMaintained by [@jeffallan](https:\/\/github.com\/jeffallan), Principal Consultant at [Synergetic Solutions](https:\/\/synergetic.solutions)\n\n[Documentation](https:\/\/jeffallan.github.io\/claude-skills\/skills\/data-ml\/pandas-pro\/)\n","use_cases":["Data cleaning with missing value handling and type conversion","Aggregation and groupby operations for summarizing data","Merging and joining DataFrames on multiple keys","Time series resampling and analysis","Memory optimization for large datasets"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/Jeffallan\/claude-skills\/blob\/a8be463010e2ca23afe00ea00773aea7128e8971\/plugin\/skills\/pandas-pro\/SKILL.md","source_commit":"a8be463010e2ca23afe00ea00773aea7128e8971","license":null,"version":null,"listing_approved_at":"2026-11-29","created_at":"2026-11-28T18:47:36.000000Z","updated_at":"2026-11-29T10:53:27.000000Z","seo_title":"Pandas Pro - Expert DataFrame Operations for Data Manipulation","seo_description":"Optimize and transform pandas DataFrames with expert-level operations for data cleaning, aggregation, merging, and time series analysis. Includes validation and memory-ef","seo_keywords":["pandas","DataFrame","data manipulation","data cleaning","aggregation","groupby","merge","join"]}}