Menu

1 / 4

I Used the Idealista API in Python to Rank Madrid Districts by Rental Yield

DEV Community: python·Happy Endpoint·15 days ago
#30sg9HpY
#devtopython#devto#dev#sale#rent
Reading 0:00
15s threshold

A flat in Villaverde pays back its asking price in 13.9 years of asking rent. In Barrio de Salamanca, the same calculation gives 32.3 years.

I wanted to know how wide that gap really is across Madrid, and how much of it survives once you clean the data properly. So I pulled for-sale and for-rent listings for all 21 Madrid districts from Idealista with Python, computed a gross rental yield per district, and then went looking for everything that could distort it.

The data

Idealista's own developer API is granted by application , so for this I used the Happy Endpoint Idealista API , which returns the public search results as JSON.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.