Reading a rental-yield CSV without inventing missing data

●1 ●4
calendar_today • schedule2 min read

A small CSV can be easy to load and surprisingly easy to misinterpret. This walkthrough uses dataHabibi's owned June 2026 Dubai community rental-yield snapshot to show how to preserve units, missing values and the distinction between a community and a city aggregate.

Disclosure: I am Haron Merzaie, co-founder of dataHabibi alongside Ibrahim Qorraj. The source platform is https://datahabibi.ae/. This is a historical data-reading example, not a live feed or an investment recommendation.

Start with the file's actual schema

The CSV has six columns: Community, Gross rental yield percent, Buildings tracked, Yield sample size, Snapshot, and Source. There are twelve named community rows and one row labelled Dubai city average.

The dataset and its field documentation are available in the public repository datahabibi-bot/dubai-community-yields-june-2026 on GitHub. Download dubai-community-yields-june-2026.csv from that repository and put it beside your Python script.

For example, the International City row records 9.98 in the yield field, 358 buildings tracked and a yield sample size of 220. The city-average row records 8.16 and 2,561 buildings, but has a blank sample-size field. These are values in this particular snapshot; they do not describe today's market.

Preserve percentages and missing values

The value 9.98 means 9.98 percent. If a later calculation needs a decimal fraction, convert it explicitly by dividing by 100. Do not silently switch between percentage points and fractions.

The blank city-average sample size means the source did not supply it. Converting it to zero would change the meaning of the file. Represent it as None instead.

This standard-library example preserves those distinctions:

import csv
from decimal import Decimal

with open("dubai-community-yields-june-2026.csv", newline="", encoding="utf-8") as source:
    rows = list(csv.DictReader(source))

records = []
for row in rows:
    sample_text = row["Yield sample size"].strip()
    records.append({
        "community": row["Community"],
        "yield_percent": Decimal(row["Gross rental yield percent"]),
        "buildings_tracked": int(row["Buildings tracked"]),
        "yield_sample_size": int(sample_text) if sample_text else None,
        "snapshot": row["Snapshot"],
    })

communities = [r for r in records if r["community"] != "Dubai city average"]
city_rows = [r for r in records if r["community"] == "Dubai city average"]

for record in communities:
    print(record["community"], record["yield_percent"], record["yield_sample_size"])

Decimal keeps the recorded decimal representation explicit. The original CSV remains unchanged, so another reader can distinguish source values from transformations in your code.

Do not manufacture an aggregation method

Separating city_rows prevents the city aggregate from being treated as a thirteenth community. It also avoids accidentally including the aggregate in an average of community rows.

The snapshot does not specify the sample unit, weights or aggregation method. Buildings tracked therefore cannot be assumed to be the yield denominator. The displayed community rows cannot independently reconstruct the city-average yield. A chart can show recorded values, but its caption should name the June 2026 period and explain that limitation.

The CSV also does not include the underlying rents and property prices needed to recompute yields. Gross rental yield is different from net yield or total return. Service charges, vacancy, maintenance, financing and transaction costs are not fields in this file. It contains no price forecast or guaranteed future return.

Make reuse traceable

The owned dataset is released under CC BY 4.0. When sharing an adaptation, credit dataHabibi, identify the June 2026 snapshot, include the licence and indicate changes. The dataset release does not include rights to the logo or commercial platform source code.

The practical lesson is small: retain the source file, describe its units, preserve blanks, separate aggregate rows and state what the data cannot establish. Those choices make a simple CSV analysis easier for another developer to inspect and reproduce.

Want more #python & #datascience deep dives?

Join 6,128+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

1 Comment

0 votes

More Posts

Dashboard Operasional Armada Rental Mobil dengan Python + FastAPI

Masbadar - Mar 12

Sealing My Own Experiment

Ken W. Algerverified - Dec 1

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Stop trusting verdicts your policy no longer supports

VEACESLAV - Dec 1

When One Python Process Fails, You Need to See All of Them

Tom Smithverified - Nov 23
chevron_left
133 Points • 5 Badges
1Posts
0Comments
Haron Merzaie is co-founder of dataHabibi, a Dubai housing data and research platform, alongside Ibrahim Qorraj.

Commenters (This Week)

11 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!