跳到正文
DEV Community· Robin Beraud-Sudreau·· 2 小時前AI 評分44

用一條命令分析法國房屋成交價格

Local property prices in France, from recorded sales, in one command

AI 導讀

作者撰寫 Hermes 技能 area-market-analysis,以一條命令整理法國 DVF 成交資料,按年份統計公寓及住宅的成交量、中位每平方米價格和四分位距。工具會按交易合併資料列,並篩選單一公寓或住宅交易作價格統計;最新年份資料可能不完整,統計亦未反映房屋狀況和具體位置。

正文

Robin Beraud-Sudreau

Asking prices on listing sites show what sellers hope for. France also publishes what buyers actually paid: the DVF dataset (land value requests) on data.gouv.fr, free and without an API key. The catch: raw files have one row per parcel and per dwelling, so a naive "price divided by surface" average counts some sales several times and mixes in garages, land and shops.

I wrote a Hermes skill, area-market-analysis, that does the cleanup. It resolves a commune name to its INSEE code, downloads the yearly CSV files, groups rows by sale, and keeps only clean single-apartment or single-house sales for price statistics. Other sales (multi-unit, commercial, land) still count toward volume. Paris, Lyon and Marseille are expanded to arrondissements. Pure Python standard library.

python3 scripts/dvf_area.py --commune Bordeaux --years 2021-2024

You get one line per year: sales count, then for apartments and houses the observations, median price per m2 and interquartile range, plus the change between first and last year.

Limits are stated in the output and the docs: a commune is a coarse area, medians ignore condition and location, and the latest year can be incomplete. I ran it on Bordeaux and Lyon and added an offline self-test; overseas communes and Corsica are untested.


Skill (MIT): https://github.com/RobinBeraud/hermes-skills/tree/main/data-analysis/area-market-analysis
All skills: https://github.com/RobinBeraud/hermes-skills

This post was written with AI assistance and reviewed through automated checks.

來源:DEV Community · dev.to