CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-tabulate

tessl install tessl/pypi-tabulate@0.9.0

Pretty-print tabular data in Python with extensive formatting options and output format support.

Agent Success

Agent success rate when using this tile

69%

Improvement

Agent success rate improvement when using this tile compared to baseline

0.9x

Baseline

Agent success rate without this tile

77%

task.mdevals/scenario-5/

Financial Report Table Generator

Build a program that generates formatted financial reports from data files. The program should read financial data and produce well-aligned tables suitable for presentation in reports.

Requirements

Your program should read financial data from a CSV file and generate a formatted table with appropriate column alignment. The input CSV will contain:

  • Account names (text)
  • Current period values (numbers with decimals)
  • Prior period values (numbers with decimals)
  • Variance percentages (numbers with decimals)
  • Status indicators (text: "Good", "Warning", "Critical")

The program must:

  1. Read data from a CSV file path provided as a command-line argument
  2. Generate a formatted table with columns aligned as follows:
    • Account names: left-aligned
    • All numeric values: decimal-aligned (aligning on the decimal point)
    • Status indicators: center-aligned
  3. Output the formatted table to stdout in a grid format with borders
  4. Handle both positive and negative numbers correctly

Input Format

The CSV file will have the following columns:

Account,Current,Prior,Variance,Status

Example input file (financial_data.csv):

Account,Current,Prior,Variance,Status
Revenue,125000.50,98000.00,27.55,Good
Operating Expenses,45000.75,52000.00,-13.46,Good
Net Income,80000.25,46000.00,73.91,Good
Cash Flow,15500.00,28000.00,-44.64,Warning

Output Format

The program should produce a table with clear borders and properly aligned columns. Numeric columns should align on decimal points for easy comparison.

Test Cases

  • Given a CSV file with 4 accounts, the program generates a table with all account names left-aligned @test
  • Given a CSV file with mixed positive and negative numbers, all numeric columns align on the decimal point @test
  • Given a CSV file with status values, the status column is center-aligned @test

@generates

API

def generate_report(csv_filepath: str) -> str:
    """
    Read financial data from a CSV file and return a formatted table.

    Args:
        csv_filepath: Path to the CSV file containing financial data

    Returns:
        A formatted string containing the table with proper alignment
    """
    pass

Dependencies { .dependencies }

tabulate { .dependency }

Provides table formatting support.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/tabulate@0.9.x
tile.json