File size: 2,754 Bytes
ef987bb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # Diamond prices and market segments
Analyze `diamonds.csv` offline. Provide a runnable Python entry script in the project root (for example `main.py` or `solve.py`). Regenerate all outputs beside the input on each run. If there is more than one root Python file and no unique `main.py` or `solve.py`, write the entry script’s filename on one line in `entrypoint.txt`. You can also use that file to select a different entry explicitly.
## Statistics and outputs
- Count each category in `cut`, `color`, and `clarity`.
- Write `cut_price_stats.csv` with one row per cut and its mean and median price. Counts are optional; if included, use exact counts.
- Write `top_10_diamonds.csv` with the ten highest-priced rows in descending order, keeping each diamond's `price`, `carat`, and `z` together.
- Write `price_bin_stats.csv` with all three counts, including zero-count bins: `0-1000` for price < 1000, `1000-5000` for 1000 ≤ price < 5000, and `5000+` for price ≥ 5000.
## Report
Create an offline `report.html` with visible tables for all three category distributions, cut statistics, the ordered top ten and all price bins. Use headers with the corresponding English or Chinese meanings: cut/切工, color/颜色, clarity/净度, count/数量/频数, mean/平均价格, median/中位价格, price_bin/价格分档, price/价格, carat/克拉 and z/深度. Keep row associations correct. Thousands separators, currency symbols, column order, equivalent decimals and styling are flexible. Preserve at least two decimal places of precision where rounding price statistics; counts are exact.
Plot carat (x) versus price (y) in a visible SVG or Canvas scatter chart. Use all rows when there are at most 1000; larger inputs may be sampled to 1000. Use paired values from individual rows and linear scales. Label the axes “carat” or “克拉” and “price” or “价格”, with at least two distinct numeric ticks per axis. Render labels and ticks visibly using SVG `<text>` or Canvas `fillText` or `strokeText`. Put x ticks below the plot, and y ticks to the left or right. Ticks use actual data units and may use decimals, thousands separators or scientific notation. Use visible 2–40 px marks spanning at least 50 px on each axis; do not add illustrative points to the data region.
## Acceptance Checklist
- CSV and visible table values agree with the source data: category counts, cut means/medians, all bin counts and descending top-ten rows with the correct price/carat/z associations.
- Rendered marks match the source's carat/price pairs under the labeled numeric scales. The plot is legible and visible offline.
- Rerunning the analysis after input values change recomputes the CSV data, displayed values and plotted points.
|