Finance

S&P 500 Financial Ratios Analysis

Compute and compare key financial ratios (P/E, ROE, debt-to-equity) for S&P 500 companies and identify undervalued stocks.

What

This AI Data Analyst workflow loads the S&P 500 company financials CSV and summarizes available columns and basic descriptive statistics. It computes and compares key financial ratios such as P/E, ROE, and debt-to-equity, and visualizes P/E distributions by sector. It filters companies using rules like P/E < 15 and ROE > 15% and creates a P/E vs earnings growth scatter plot colored by sector to support value-screening.

Who

This is for analysts and investors who want a reproducible, code-driven way to screen S&P 500 companies using common valuation and profitability ratios. It helps users compare sectors and identify candidates that meet explicit ratio thresholds using tables and plots.

Tools

  • pandas
  • numpy
  • matplotlib
  • seaborn
  • jupyter

Outcomes

  • Loaded dataset with ~505 rows and key columns (e.g., Price, EPS, P/E)
  • Basic stats and column overview for the financials table
  • Sector-level P/E distribution plots (e.g., box plots)
  • Filtered table of companies meeting value-screen criteria (P/E and ROE thresholds)
  • Scatter plot of P/E vs earnings growth colored by sector with annotations

Quality Score

5/10

gpt-5.2mljar-ai

Last scored: Apr 7, 2026

  • Task Completion: 1/2

    Needs work

    Loaded the dataset, showed columns/stats, produced a sector P/E boxplot (top 15 sectors), and generated a filtered “value stocks” table using an estimated ROE. The required P/E vs earnings growth scatter plot (with sector colors and quadrant annotations) was not implemented, and the dataset does not include an earnings growth field.

  • Execution Correctness: 2/2

    Excellent

    All provided code blocks are syntactically valid and use standard pandas/seaborn/matplotlib operations; they should run given network access to the CSV. Filtering and plotting code is coherent and consistent with the shown outputs.

  • Output Quality: 1/3

    Needs work

    Outputs partially match expectations: columns/stats are shown and a P/E-by-sector boxplot is produced, plus a filtered candidate table. However, expected 505 rows/explicit P/E column naming is not met (shown as 503 rows and uses Price/Earnings), and the key scatter plot with quadrant annotations is missing.

  • Reasoning Quality: 1/2

    Needs work

    Correctly notes ROE is absent and attempts an approximation, but the ROE_est formula (Price/Book divided by Price/Earnings) is presented without sufficient justification and may be misleading as a proxy for ROE. Reasoning about limiting sectors for readability is sound.

  • Reliability: 0/1

    Needs work

    Workflow is fragile relative to the spec: it relies on an improvised ROE proxy and cannot complete the earnings-growth scatter because the needed variable is not present, with no robust fallback (e.g., alternative growth metric or explicit acknowledgment/adjusted requirement).

load S&P 500 financials https://raw.githubusercontent.com/pplonski/datasets-for-start/refs/heads/master/sp500-company-financials/constituents-financials.csv and show available columns and basic stats

You reached prompts limit, please contact us for more.

plot distribution of P/E ratios by sector

You reached prompts limit, please contact us for more.

identify companies with P/E < 15 and ROE > 15% — potential value stocks

You reached prompts limit, please contact us for more.

create a scatter plot of P/E vs earnings growth colored by sector

You reached prompts limit, please contact us for more.

Browse All Analysis Examples