[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6MVSHWFEV4M7J3CE6EDEJ28":3,"skill-same:01M6MVSHWFEV4M7J3CE6EDEJ28":86},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":58,"commitSha":59,"skillDirectory":60,"forksCount":61,"repositoryHtmlUrl":62,"repositoryHomepageUrl":6,"ownerHtmlUrl":63,"ownerBlogUrl":6,"ownerDescription":64,"updatedAt":65,"install":66,"resources":79},"01M6MVSHWFEV4M7J3CE6EDEJ28","table-extractor",null,"Extract tables from PDFs with high accuracy using camelot - handles complex table structures","Kernel8901\u002Fai-agent-skills-classification","Kernel8901","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F72647553?v=4","01M6KV388J2H5PNC8D8P940BJD","01M6KV38CS5B3AY63RKZB410YM",7,"MIT","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002FPDF及文件\u002Ftable-extractor\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"table extractor","table","computer","accuracy","high","tables","opus","sonnet","with","camelot","operations","PDF","execution","data","office","file","https","dev","code","github","2026-11-10 10:12:30",false,"---\nname: table-extractor\ndescription: Extract tables from PDFs with high accuracy using camelot - handles complex table structures\nauthor: claude-office-skills\nversion: \"1.0\"\ntags: [table, extraction, camelot, pdf, data]\nmodels: [claude-sonnet-4, claude-opus-4]\ntools: [computer, code_execution, file_operations]\nlibrary:\n  name: camelot-py\n  url: https:\u002F\u002Fgithub.com\u002Fcamelot-dev\u002Fcamelot\n  stars: 4.2k\n---\n\n# Table Extractor Skill\n\n## Overview\n\nThis skill enables precise extraction of tables from PDF documents using **camelot** - the gold standard for PDF table extraction. Handle complex tables with merged cells, borderless tables, and multi-page layouts with high accuracy.\n\n## How to Use\n\n1. Provide the PDF containing tables\n2. Optionally specify pages or table detection method\n3. I'll extract tables as pandas DataFrames\n\n**Example prompts:**\n- \"Extract all tables from this PDF\"\n- \"Get the table on page 5 of this report\"\n- \"Extract borderless tables from this document\"\n- \"Convert PDF tables to Excel format\"\n\n## Domain Knowledge\n\n### camelot Fundamentals\n\n```python\nimport camelot\n\n# Extract tables from PDF\ntables = camelot.read_pdf('document.pdf')\n\n# Access results\nprint(f\"Found {len(tables)} tables\")\n\n# Get first table as DataFrame\ndf = tables[0].df\nprint(df)\n```\n\n### Extraction Methods\n\n| Method | Use Case | Description |\n|--------|----------|-------------|\n| `lattice` | Bordered tables | Detects table by lines\u002Fborders |\n| `stream` | Borderless tables | Uses text positioning |\n\n```python\n# Lattice method (default) - for tables with visible borders\ntables = camelot.read_pdf('document.pdf', flavor='lattice')\n\n# Stream method - for borderless tables\ntables = camelot.read_pdf('document.pdf', flavor='stream')\n```\n\n### Page Selection\n\n```python\n# Single page\ntables = camelot.read_pdf('document.pdf', pages='1')\n\n# Multiple pages\ntables = camelot.read_pdf('document.pdf', pages='1,3,5')\n\n# Page range\ntables = camelot.read_pdf('document.pdf', pages='1-5')\n\n# All pages\ntables = camelot.read_pdf('document.pdf', pages='all')\n```\n\n### Advanced Options\n\n#### Lattice Options\n```python\ntables = camelot.read_pdf(\n    'document.pdf',\n    flavor='lattice',\n    line_scale=40,              # Line detection sensitivity\n    copy_text=['h', 'v'],       # Copy text across merged cells\n    shift_text=['l', 't'],      # Shift text alignment\n    split_text=True,            # Split text at newlines\n    flag_size=True,             # Flag super\u002Fsubscripts\n    strip_text='\\n',            # Characters to strip\n    process_background=False,   # Process background lines\n)\n```\n\n#### Stream Options\n```python\ntables = camelot.read_pdf(\n    'document.pdf',\n    flavor='stream',\n    edge_tol=500,               # Edge tolerance\n    row_tol=10,                 # Row tolerance\n    column_tol=0,               # Column tolerance\n    strip_text='\\n',            # Characters to strip\n)\n```\n\n### Table Area Specification\n\n```python\n# Extract from specific area (x1, y1, x2, y2)\n# Coordinates from bottom-left, in PDF points (72 points = 1 inch)\ntables = camelot.read_pdf(\n    'document.pdf',\n    table_areas=['72,720,540,400'],  # One area\n)\n\n# Multiple areas\ntables = camelot.read_pdf(\n    'document.pdf',\n    table_areas=['72,720,540,400', '72,380,540,200'],\n)\n```\n\n### Column Specification\n\n```python\n# Manually specify column positions (for stream method)\ntables = camelot.read_pdf(\n    'document.pdf',\n    flavor='stream',\n    columns=['100,200,300,400'],  # X positions of column separators\n)\n```\n\n### Working with Results\n\n```python\nimport camelot\n\ntables = camelot.read_pdf('document.pdf')\n\nfor i, table in enumerate(tables):\n    # Access DataFrame\n    df = table.df\n    \n    # Table metadata\n    print(f\"Table {i+1}:\")\n    print(f\"  Page: {table.page}\")\n    print(f\"  Accuracy: {table.accuracy}\")\n    print(f\"  Whitespace: {table.whitespace}\")\n    print(f\"  Order: {table.order}\")\n    print(f\"  Shape: {df.shape}\")\n    \n    # Parsing report\n    report = table.parsing_report\n    print(f\"  Report: {report}\")\n```\n\n### Export Options\n\n```python\nimport camelot\n\ntables = camelot.read_pdf('document.pdf')\n\n# Export to CSV\ntables[0].to_csv('table.csv')\n\n# Export to Excel\ntables[0].to_excel('table.xlsx')\n\n# Export to JSON\ntables[0].to_json('table.json')\n\n# Export to HTML\ntables[0].to_html('table.html')\n\n# Export all tables\nfor i, table in enumerate(tables):\n    table.to_excel(f'table_{i+1}.xlsx')\n```\n\n### Visual Debugging\n\n```python\nimport camelot\n\n# Enable visual debugging\ntables = camelot.read_pdf('document.pdf')\n\n# Plot detected table areas\ncamelot.plot(tables[0], kind='contour').show()\n\n# Plot text on table\ncamelot.plot(tables[0], kind='text').show()\n\n# Plot detected lines (lattice only)\ncamelot.plot(tables[0], kind='joint').show()\ncamelot.plot(tables[0], kind='line').show()\n\n# Save plot\nfig = camelot.plot(tables[0])\nfig.savefig('debug.png')\n```\n\n### Handling Multi-page Tables\n\n```python\nimport camelot\nimport pandas as pd\n\ndef extract_multipage_table(pdf_path, pages='all'):\n    \"\"\"Extract and combine tables that span multiple pages.\"\"\"\n    \n    tables = camelot.read_pdf(pdf_path, pages=pages)\n    \n    # Group tables by similar structure (columns)\n    table_groups = {}\n    \n    for table in tables:\n        cols = tuple(table.df.columns)\n        if cols not in table_groups:\n            table_groups[cols] = []\n        table_groups[cols].append(table.df)\n    \n    # Combine similar tables\n    combined = []\n    for cols, dfs in table_groups.items():\n        if len(dfs) > 1:\n            # Combine and deduplicate header rows\n            combined_df = pd.concat(dfs, ignore_index=True)\n            combined.append(combined_df)\n        else:\n            combined.append(dfs[0])\n    \n    return combined\n```\n\n## Best Practices\n\n1. **Try Both Methods**: Lattice for bordered, stream for borderless\n2. **Check Accuracy Score**: Above 90% is usually good\n3. **Use Visual Debugging**: Understand extraction results\n4. **Specify Areas**: For PDFs with multiple table types\n5. **Handle Headers**: First row often needs special treatment\n\n## Common Patterns\n\n### Batch Table Extraction\n```python\nimport camelot\nfrom pathlib import Path\nimport pandas as pd\n\ndef batch_extract_tables(input_dir, output_dir):\n    \"\"\"Extract tables from all PDFs in directory.\"\"\"\n    \n    input_path = Path(input_dir)\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    results = []\n    \n    for pdf_file in input_path.glob('*.pdf'):\n        try:\n            tables = camelot.read_pdf(str(pdf_file), pages='all')\n            \n            for i, table in enumerate(tables):\n                # Skip low accuracy tables\n                if table.accuracy \u003C 80:\n                    continue\n                \n                output_file = output_path \u002F f\"{pdf_file.stem}_table_{i+1}.xlsx\"\n                table.to_excel(str(output_file))\n                \n                results.append({\n                    'source': str(pdf_file),\n                    'table': i + 1,\n                    'page': table.page,\n                    'accuracy': table.accuracy,\n                    'output': str(output_file)\n                })\n        \n        except Exception as e:\n            results.append({\n                'source': str(pdf_file),\n                'error': str(e)\n            })\n    \n    return results\n```\n\n### Auto-detect Table Method\n```python\nimport camelot\n\ndef smart_extract_tables(pdf_path, pages='1'):\n    \"\"\"Try both methods and return best results.\"\"\"\n    \n    # Try lattice first\n    lattice_tables = camelot.read_pdf(pdf_path, pages=pages, flavor='lattice')\n    \n    # Try stream\n    stream_tables = camelot.read_pdf(pdf_path, pages=pages, flavor='stream')\n    \n    # Compare and return best\n    results = []\n    \n    if lattice_tables and lattice_tables[0].accuracy > 70:\n        results.extend(lattice_tables)\n    elif stream_tables:\n        results.extend(stream_tables)\n    \n    return results\n```\n\n## Examples\n\n### Example 1: Financial Statement Extraction\n```python\nimport camelot\nimport pandas as pd\n\ndef extract_financial_tables(pdf_path):\n    \"\"\"Extract financial tables from annual report.\"\"\"\n    \n    # Extract all tables\n    tables = camelot.read_pdf(pdf_path, pages='all', flavor='lattice')\n    \n    financial_data = {\n        'income_statement': None,\n        'balance_sheet': None,\n        'cash_flow': None,\n        'other_tables': []\n    }\n    \n    for table in tables:\n        df = table.df\n        text = df.to_string().lower()\n        \n        # Identify table type\n        if 'revenue' in text or 'sales' in text:\n            if 'operating income' in text or 'net income' in text:\n                financial_data['income_statement'] = df\n        elif 'asset' in text and 'liabilities' in text:\n            financial_data['balance_sheet'] = df\n        elif 'cash flow' in text or 'operating activities' in text:\n            financial_data['cash_flow'] = df\n        else:\n            financial_data['other_tables'].append({\n                'page': table.page,\n                'data': df,\n                'accuracy': table.accuracy\n            })\n    \n    return financial_data\n\nfinancials = extract_financial_tables('annual_report.pdf')\nif financials['income_statement'] is not None:\n    print(\"Income Statement found:\")\n    print(financials['income_statement'])\n```\n\n### Example 2: Scientific Data Extraction\n```python\nimport camelot\nimport pandas as pd\n\ndef extract_research_data(pdf_path, pages='all'):\n    \"\"\"Extract data tables from research paper.\"\"\"\n    \n    # Try lattice for bordered tables\n    tables = camelot.read_pdf(pdf_path, pages=pages, flavor='lattice')\n    \n    if not tables or all(t.accuracy \u003C 70 for t in tables):\n        # Fall back to stream for borderless\n        tables = camelot.read_pdf(pdf_path, pages=pages, flavor='stream')\n    \n    extracted_data = []\n    \n    for table in tables:\n        df = table.df\n        \n        # Clean up the DataFrame\n        # Set first row as header if it looks like one\n        if not df.iloc[0].str.contains(r'\\d').any():\n            df.columns = df.iloc[0]\n            df = df[1:]\n            df = df.reset_index(drop=True)\n        \n        extracted_data.append({\n            'page': table.page,\n            'accuracy': table.accuracy,\n            'data': df\n        })\n    \n    return extracted_data\n\ndata = extract_research_data('research_paper.pdf')\nfor i, item in enumerate(data):\n    print(f\"Table {i+1} (Page {item['page']}, Accuracy: {item['accuracy']}%):\")\n    print(item['data'].head())\n```\n\n### Example 3: Invoice Line Items\n```python\nimport camelot\n\ndef extract_invoice_items(pdf_path):\n    \"\"\"Extract line items from invoice.\"\"\"\n    \n    # Usually invoices have bordered tables\n    tables = camelot.read_pdf(pdf_path, flavor='lattice')\n    \n    line_items = []\n    \n    for table in tables:\n        df = table.df\n        \n        # Look for table with typical invoice columns\n        header_text = ' '.join(df.iloc[0].astype(str)).lower()\n        \n        if any(term in header_text for term in ['quantity', 'qty', 'amount', 'price', 'description']):\n            # This looks like a line items table\n            df.columns = df.iloc[0]\n            df = df[1:]\n            \n            for _, row in df.iterrows():\n                item = {}\n                for col in df.columns:\n                    col_lower = str(col).lower()\n                    value = row[col]\n                    \n                    if 'desc' in col_lower or 'item' in col_lower:\n                        item['description'] = value\n                    elif 'qty' in col_lower or 'quantity' in col_lower:\n                        item['quantity'] = value\n                    elif 'price' in col_lower or 'rate' in col_lower:\n                        item['unit_price'] = value\n                    elif 'amount' in col_lower or 'total' in col_lower:\n                        item['amount'] = value\n                \n                if item:\n                    line_items.append(item)\n    \n    return line_items\n\nitems = extract_invoice_items('invoice.pdf')\nfor item in items:\n    print(item)\n```\n\n### Example 4: Table Comparison\n```python\nimport camelot\nimport pandas as pd\n\ndef compare_pdf_tables(pdf1_path, pdf2_path):\n    \"\"\"Compare tables between two PDF versions.\"\"\"\n    \n    tables1 = camelot.read_pdf(pdf1_path)\n    tables2 = camelot.read_pdf(pdf2_path)\n    \n    comparisons = []\n    \n    # Match tables by shape and position\n    for t1 in tables1:\n        best_match = None\n        best_score = 0\n        \n        for t2 in tables2:\n            if t1.df.shape == t2.df.shape:\n                # Calculate similarity\n                try:\n                    similarity = (t1.df == t2.df).mean().mean()\n                    if similarity > best_score:\n                        best_score = similarity\n                        best_match = t2\n                except:\n                    pass\n        \n        if best_match:\n            comparisons.append({\n                'page1': t1.page,\n                'page2': best_match.page,\n                'similarity': best_score,\n                'identical': best_score == 1.0,\n                'diff': pd.DataFrame(t1.df != best_match.df)\n            })\n    \n    return comparisons\n\ncomparison = compare_pdf_tables('report_v1.pdf', 'report_v2.pdf')\n```\n\n## Limitations\n\n- Encrypted PDFs not supported\n- Image-based PDFs need OCR preprocessing\n- Very complex merged cells may need tuning\n- Rotated tables require preprocessing\n- Large PDFs may need page-by-page processing\n\n## Installation\n\n```bash\npip install camelot-py[cv]\n\n# Additional dependencies\n# macOS\nbrew install ghostscript tcl-tk\n\n# Ubuntu\napt-get install ghostscript python3-tk\n```\n\n## Resources\n\n- [camelot Documentation](https:\u002F\u002Fcamelot-py.readthedocs.io\u002F)\n- [GitHub Repository](https:\u002F\u002Fgithub.com\u002Fcamelot-dev\u002Fcamelot)\n- [Comparison with Other Tools](https:\u002F\u002Fcamelot-py.readthedocs.io\u002Fen\u002Fmaster\u002Fuser\u002Fintro.html#why-camelot)\n","# Table Extractor Skill\n\n## Overview\n\nThis skill enables precise extraction of tables from PDF documents using **camelot** - the gold standard for PDF table extraction. Handle complex tables with merged cells, borderless tables, and multi-page layouts with high accuracy.\n\n## How to Use\n\n1. Provide the PDF containing tables\n2. Optionally specify pages or table detection method\n3. I'll extract tables as pandas DataFrames\n\n**Example prompts:**\n- \"Extract all tables from this PDF\"\n- \"Get the table on page 5 of this report\"\n- \"Extract borderless tables from this document\"\n- \"Convert PDF tables to Excel format\"\n\n## Domain Knowledge\n\n### camelot Fundamentals\n\n```python\nimport camelot\n\n# Extract tables from PDF\ntables = camelot.read_pdf('document.pdf')\n\n# Access results\nprint(f\"Found {len(tables)} tables\")\n\n# Get first table as DataFrame\ndf = tables[0].df\nprint(df)\n```\n\n### Extraction Methods\n\n| Method | Use Case | Description |\n|--------|----------|-------------|\n| `lattice` | Bordered tables | Detects table by lines\u002Fborders |\n| `stream` | Borderless tables | Uses text positioning |\n\n```python\n# Lattice method (default) - for tables with visible borders\ntables = camelot.read_pdf('document.pdf', flavor='lattice')\n\n# Stream method - for borderless tables\ntables = camelot.read_pdf('document.pdf', flavor='stream')\n```\n\n### Page Selection\n\n```python\n# Single page\ntables = camelot.read_pdf('document.pdf', pages='1')\n\n# Multiple pages\ntables = camelot.read_pdf('document.pdf', pages='1,3,5')\n\n# Page range\ntables = camelot.read_pdf('document.pdf', pages='1-5')\n\n# All pages\ntables = camelot.read_pdf('document.pdf', pages='all')\n```\n\n### Advanced Options\n\n#### Lattice Options\n```python\ntables = camelot.read_pdf(\n    'document.pdf',\n    flavor='lattice',\n    line_scale=40,              # Line detection sensitivity\n    copy_text=['h', 'v'],       # Copy text across merged cells\n    shift_text=['l', 't'],      # Shift text alignment\n    split_text=True,            # Split text at newlines\n    flag_size=True,             # Flag super\u002Fsubscripts\n    strip_text='\\n',            # Characters to strip\n    process_background=False,   # Process background lines\n)\n```\n\n#### Stream Options\n```python\ntables = camelot.read_pdf(\n    'document.pdf',\n    flavor='stream',\n    edge_tol=500,               # Edge tolerance\n    row_tol=10,                 # Row tolerance\n    column_tol=0,               # Column tolerance\n    strip_text='\\n',            # Characters to strip\n)\n```\n\n### Table Area Specification\n\n```python\n# Extract from specific area (x1, y1, x2, y2)\n# Coordinates from bottom-left, in PDF points (72 points = 1 inch)\ntables = camelot.read_pdf(\n    'document.pdf',\n    table_areas=['72,720,540,400'],  # One area\n)\n\n# Multiple areas\ntables = camelot.read_pdf(\n    'document.pdf',\n    table_areas=['72,720,540,400', '72,380,540,200'],\n)\n```\n\n### Column Specification\n\n```python\n# Manually specify column positions (for stream method)\ntables = camelot.read_pdf(\n    'document.pdf',\n    flavor='stream',\n    columns=['100,200,300,400'],  # X positions of column separators\n)\n```\n\n### Working with Results\n\n```python\nimport camelot\n\ntables = camelot.read_pdf('document.pdf')\n\nfor i, table in enumerate(tables):\n    # Access DataFrame\n    df = table.df\n    \n    # Table metadata\n    print(f\"Table {i+1}:\")\n    print(f\"  Page: {table.page}\")\n    print(f\"  Accuracy: {table.accuracy}\")\n    print(f\"  Whitespace: {table.whitespace}\")\n    print(f\"  Order: {table.order}\")\n    print(f\"  Shape: {df.shape}\")\n    \n    # Parsing report\n    report = table.parsing_report\n    print(f\"  Report: {report}\")\n```\n\n### Export Options\n\n```python\nimport camelot\n\ntables = camelot.read_pdf('document.pdf')\n\n# Export to CSV\ntables[0].to_csv('table.csv')\n\n# Export to Excel\ntables[0].to_excel('table.xlsx')\n\n# Export to JSON\ntables[0].to_json('table.json')\n\n# Export to HTML\ntables[0].to_html('table.html')\n\n# Export all tables\nfor i, table in enumerate(tables):\n    table.to_excel(f'table_{i+1}.xlsx')\n```\n\n### Visual Debugging\n\n```python\nimport camelot\n\n# Enable visual debugging\ntables = camelot.read_pdf('document.pdf')\n\n# Plot detected table areas\ncamelot.plot(tables[0], kind='contour').show()\n\n# Plot text on table\ncamelot.plot(tables[0], kind='text').show()\n\n# Plot detected lines (lattice only)\ncamelot.plot(tables[0], kind='joint').show()\ncamelot.plot(tables[0], kind='line').show()\n\n# Save plot\nfig = camelot.plot(tables[0])\nfig.savefig('debug.png')\n```\n\n### Handling Multi-page Tables\n\n```python\nimport camelot\nimport pandas as pd\n\ndef extract_multipage_table(pdf_path, pages='all'):\n    \"\"\"Extract and combine tables that span multiple pages.\"\"\"\n    \n    tables = camelot.read_pdf(pdf_path, pages=pages)\n    \n    # Group tables by similar structure (columns)\n    table_groups = {}\n    \n    for table in tables:\n        cols = tuple(table.df.columns)\n        if cols not in table_groups:\n            table_groups[cols] = []\n        table_groups[cols].append(table.df)\n    \n    # Combine similar tables\n    combined = []\n    for cols, dfs in table_groups.items():\n        if len(dfs) > 1:\n            # Combine and deduplicate header rows\n            combined_df = pd.concat(dfs, ignore_index=True)\n            combined.append(combined_df)\n        else:\n            combined.append(dfs[0])\n    \n    return combined\n```\n\n## Best Practices\n\n1. **Try Both Methods**: Lattice for bordered, stream for borderless\n2. **Check Accuracy Score**: Above 90% is usually good\n3. **Use Visual Debugging**: Understand extraction results\n4. **Specify Areas**: For PDFs with multiple table types\n5. **Handle Headers**: First row often needs special treatment\n\n## Common Patterns\n\n### Batch Table Extraction\n```python\nimport camelot\nfrom pathlib import Path\nimport pandas as pd\n\ndef batch_extract_tables(input_dir, output_dir):\n    \"\"\"Extract tables from all PDFs in directory.\"\"\"\n    \n    input_path = Path(input_dir)\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n    \n    results = []\n    \n    for pdf_file in input_path.glob('*.pdf'):\n        try:\n            tables = camelot.read_pdf(str(pdf_file), pages='all')\n            \n            for i, table in enumerate(tables):\n                # Skip low accuracy tables\n                if table.accuracy \u003C 80:\n                    continue\n                \n                output_file = output_path \u002F f\"{pdf_file.stem}_table_{i+1}.xlsx\"\n                table.to_excel(str(output_file))\n                \n                results.append({\n                    'source': str(pdf_file),\n                    'table': i + 1,\n                    'page': table.page,\n                    'accuracy': table.accuracy,\n                    'output': str(output_file)\n                })\n        \n        except Exception as e:\n            results.append({\n                'source': str(pdf_file),\n                'error': str(e)\n            })\n    \n    return results\n```\n\n### Auto-detect Table Method\n```python\nimport camelot\n\ndef smart_extract_tables(pdf_path, pages='1'):\n    \"\"\"Try both methods and return best results.\"\"\"\n    \n    # Try lattice first\n    lattice_tables = camelot.read_pdf(pdf_path, pages=pages, flavor='lattice')\n    \n    # Try stream\n    stream_tables = camelot.read_pdf(pdf_path, pages=pages, flavor='stream')\n    \n    # Compare and return best\n    results = []\n    \n    if lattice_tables and lattice_tables[0].accuracy > 70:\n        results.extend(lattice_tables)\n    elif stream_tables:\n        results.extend(stream_tables)\n    \n    return results\n```\n\n## Examples\n\n### Example 1: Financial Statement Extraction\n```python\nimport camelot\nimport pandas as pd\n\ndef extract_financial_tables(pdf_path):\n    \"\"\"Extract financial tables from annual report.\"\"\"\n    \n    # Extract all tables\n    tables = camelot.read_pdf(pdf_path, pages='all', flavor='lattice')\n    \n    financial_data = {\n        'income_statement': None,\n        'balance_sheet': None,\n        'cash_flow': None,\n        'other_tables': []\n    }\n    \n    for table in tables:\n        df = table.df\n        text = df.to_string().lower()\n        \n        # Identify table type\n        if 'revenue' in text or 'sales' in text:\n            if 'operating income' in text or 'net income' in text:\n                financial_data['income_statement'] = df\n        elif 'asset' in text and 'liabilities' in text:\n            financial_data['balance_sheet'] = df\n        elif 'cash flow' in text or 'operating activities' in text:\n            financial_data['cash_flow'] = df\n        else:\n            financial_data['other_tables'].append({\n                'page': table.page,\n                'data': df,\n                'accuracy': table.accuracy\n            })\n    \n    return financial_data\n\nfinancials = extract_financial_tables('annual_report.pdf')\nif financials['income_statement'] is not None:\n    print(\"Income Statement found:\")\n    print(financials['income_statement'])\n```\n\n### Example 2: Scientific Data Extraction\n```python\nimport camelot\nimport pandas as pd\n\ndef extract_research_data(pdf_path, pages='all'):\n    \"\"\"Extract data tables from research paper.\"\"\"\n    \n    # Try lattice for bordered tables\n    tables = camelot.read_pdf(pdf_path, pages=pages, flavor='lattice')\n    \n    if not tables or all(t.accuracy \u003C 70 for t in tables):\n        # Fall back to stream for borderless\n        tables = camelot.read_pdf(pdf_path, pages=pages, flavor='stream')\n    \n    extracted_data = []\n    \n    for table in tables:\n        df = table.df\n        \n        # Clean up the DataFrame\n        # Set first row as header if it looks like one\n        if not df.iloc[0].str.contains(r'\\d').any():\n            df.columns = df.iloc[0]\n            df = df[1:]\n            df = df.reset_index(drop=True)\n        \n        extracted_data.append({\n            'page': table.page,\n            'accuracy': table.accuracy,\n            'data': df\n        })\n    \n    return extracted_data\n\ndata = extract_research_data('research_paper.pdf')\nfor i, item in enumerate(data):\n    print(f\"Table {i+1} (Page {item['page']}, Accuracy: {item['accuracy']}%):\")\n    print(item['data'].head())\n```\n\n### Example 3: Invoice Line Items\n```python\nimport camelot\n\ndef extract_invoice_items(pdf_path):\n    \"\"\"Extract line items from invoice.\"\"\"\n    \n    # Usually invoices have bordered tables\n    tables = camelot.read_pdf(pdf_path, flavor='lattice')\n    \n    line_items = []\n    \n    for table in tables:\n        df = table.df\n        \n        # Look for table with typical invoice columns\n        header_text = ' '.join(df.iloc[0].astype(str)).lower()\n        \n        if any(term in header_text for term in ['quantity', 'qty', 'amount', 'price', 'description']):\n            # This looks like a line items table\n            df.columns = df.iloc[0]\n            df = df[1:]\n            \n            for _, row in df.iterrows():\n                item = {}\n                for col in df.columns:\n                    col_lower = str(col).lower()\n                    value = row[col]\n                    \n                    if 'desc' in col_lower or 'item' in col_lower:\n                        item['description'] = value\n                    elif 'qty' in col_lower or 'quantity' in col_lower:\n                        item['quantity'] = value\n                    elif 'price' in col_lower or 'rate' in col_lower:\n                        item['unit_price'] = value\n                    elif 'amount' in col_lower or 'total' in col_lower:\n                        item['amount'] = value\n                \n                if item:\n                    line_items.append(item)\n    \n    return line_items\n\nitems = extract_invoice_items('invoice.pdf')\nfor item in items:\n    print(item)\n```\n\n### Example 4: Table Comparison\n```python\nimport camelot\nimport pandas as pd\n\ndef compare_pdf_tables(pdf1_path, pdf2_path):\n    \"\"\"Compare tables between two PDF versions.\"\"\"\n    \n    tables1 = camelot.read_pdf(pdf1_path)\n    tables2 = camelot.read_pdf(pdf2_path)\n    \n    comparisons = []\n    \n    # Match tables by shape and position\n    for t1 in tables1:\n        best_match = None\n        best_score = 0\n        \n        for t2 in tables2:\n            if t1.df.shape == t2.df.shape:\n                # Calculate similarity\n                try:\n                    similarity = (t1.df == t2.df).mean().mean()\n                    if similarity > best_score:\n                        best_score = similarity\n                        best_match = t2\n                except:\n                    pass\n        \n        if best_match:\n            comparisons.append({\n                'page1': t1.page,\n                'page2': best_match.page,\n                'similarity': best_score,\n                'identical': best_score == 1.0,\n                'diff': pd.DataFrame(t1.df != best_match.df)\n            })\n    \n    return comparisons\n\ncomparison = compare_pdf_tables('report_v1.pdf', 'report_v2.pdf')\n```\n\n## Limitations\n\n- Encrypted PDFs not supported\n- Image-based PDFs need OCR preprocessing\n- Very complex merged cells may need tuning\n- Rotated tables require preprocessing\n- Large PDFs may need page-by-page processing\n\n## Installation\n\n```bash\npip install camelot-py[cv]\n\n# Additional dependencies\n# macOS\nbrew install ghostscript tcl-tk\n\n# Ubuntu\napt-get install ghostscript python3-tk\n```\n\n## Resources\n\n- [camelot Documentation](https:\u002F\u002Fcamelot-py.readthedocs.io\u002F)\n- [GitHub Repository](https:\u002F\u002Fgithub.com\u002Fcamelot-dev\u002Fcamelot)\n- [Comparison with Other Tools](https:\u002F\u002Fcamelot-py.readthedocs.io\u002Fen\u002Fmaster\u002Fuser\u002Fintro.html#why-camelot)\n",{"name":5,"tags":43,"tools":46,"author":49,"models":50,"library":53,"version":57,"description":7},[19,44,27,45,31],"extraction","pdf",[20,47,48],"code_execution","file_operations","claude-office-skills",[51,52],"claude-sonnet-4","claude-opus-4",{"url":54,"name":55,"stars":56},"https:\u002F\u002Fgithub.com\u002Fcamelot-dev\u002Fcamelot","camelot-py","4.2k","1.0","main","f4cb2d49f7667e79ef7804f50396d5aaffdf1f56","PDF及文件\u002Ftable-extractor",1,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification","https:\u002F\u002Fgithub.com\u002FKernel8901","a little little little dobe in life but science geek","2026-04-05 16:43:56",{"source":8,"skillName":5,"commands":67,"prompt":77,"zipAvailable":78},[68,71,74],{"tool":69,"command":70},"npx","npx skills add Kernel8901\u002Fai-agent-skills-classification --skill table-extractor",{"tool":72,"command":73},"bunx","bunx skills add Kernel8901\u002Fai-agent-skills-classification --skill table-extractor",{"tool":75,"command":76},"pnpm","pnpm dlx skills add Kernel8901\u002Fai-agent-skills-classification --skill table-extractor","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002FPDF及文件\u002Ftable-extractor\u002FSKILL.md",true,[80],{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"_meta.json","REFERENCE","参考文档",290,"https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002FPDF及文件\u002Ftable-extractor\u002F_meta.json",[87,111,134,142,149,174],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":38},"01M6Q5R6WZ06RRB9RQTW54B34B","zyfai","Earn yield on any Ethereum wallet on Base, Arbitrum, and Plasma. Use when a user wants passive DeFi yield on their funds. Deploys a non-custodial subaccount (Safe) linked to their EOA, enables automated yield optimization, and lets them deposit\u002Fwithdraw anytime.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzyfai-sdk\u002FSKILL.md",[],[89,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110],"safe","ethereum","defi","Optimization","user","use","Wallet","base","deposit","withdraw","yield","arbitrum","non-custodial","passive","defi yield","earn","yield optimization",{"skillNo":112,"name":113,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":38},"01M6Q5R337B5JSNER4P4YS03TN","zerion-api","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api\u002FSKILL.md",[],[117,118,119,120,121,122,123,96,124,100,125,126,127,128,129,130,131,132,133],"api","zerion api","zerion","MCP","mcp server","server","blockchain","transactions","crypto wallet","crypto","evm","solana","query","across","positions","token","prices",{"skillNo":135,"name":136,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":38},"01M6Q5QZFYTDAZMZ27BN5VZXAR","zerion-api-skill","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-skill\u002FSKILL.md",[],[117,140,141,118,119,120,121,122,123,96,124,100,126,127,128,129,130,131,132,133],"api skill","zerion api skill",{"skillNo":143,"name":144,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":38},"01M6Q5QW17QW98RA3FE45E4RD8","zerion-api-mcp","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fzerion-api-mcp\u002FSKILL.md",[],[120,117,148,118,119,121,122,96,124,100,125,126,127,128,129,130,131,132,133],"zerion api mcp",{"skillNo":150,"name":151,"nameZh":6,"description":152,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":153,"categories":154,"keywords":155,"publishedAt":38},"01M6Q5QQYZB7A501BDEQWKGSJT","yahoo-finance-forex","Fetches real-time FOREX news and market data from Yahoo Finance for major currency pairs (EUR\u002FUSD, GBP\u002FUSD, USD\u002FJPY, etc.). Analyzes sentiment and provides trading context.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-forex\u002FSKILL.md",[],[156,157,158,159,160,37,34,161,162,163,164,165,166,167,168,169,170,171,172,173],"finance","yahoo finance","forex","yahoo","yahoo finance forex","sentiment","real-time","python3","install","Market","usd","news","time","currency","gbp","pip","market data","for",{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":180,"publishedAt":38},"01M6Q5QM6VS84WZVM7BKXXPF32","yahoo-finance","This skill should be used when the user asks to \"get stock prices\", \"check stock quotes\", \"look up earnings\", \"get financial data\", \"find trending stocks\", or needs stock market data from Yahoo Finance.","https:\u002F\u002Fgithub.com\u002FKernel8901\u002Fai-agent-skills-classification\u002Fblob\u002Fmain\u002F金融\u002Fyahoo-finance-cli\u002FSKILL.md",[],[156,157,159,181,182,183,184,185,186,165,187,188,189,190,191,192,193,194,133,172],"cli","homebrew","find","check","brew","up","local","get","stock","link","trending","sf","quotes","ln"]