Tuesday, September 17, 2024

x̄ - > Housing in Nairobi.- - predicting the price of an apartment.

 import pandas as pd


# Load the CSV file to examine its structure and contents

file_path = '/mnt/data/rent_apts.csv'

df = pd.read_csv(file_path)


# Display basic information about the dataset and the first few rows

df.info(), df.head()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 1848 entries, 0 to 1847
Data columns (total 7 columns):
 #   Column        Non-Null Count  Dtype  
---  ------        --------------  -----  
 0   Agency        1848 non-null   object 
 1   Neighborhood  1848 non-null   object 
 2   Price         1848 non-null   object 
 3   link          1848 non-null   object 
 4   sq_mtrs       1846 non-null   float64
 5   Bedrooms      1845 non-null   float64
 6   Bathrooms     1557 non-null   float64
dtypes: float64(3), object(4)
memory usage: 101.2+ KB
Result
(None,
                    Agency                             Neighborhood  \
 0       Buy Rent Shelters              General Mathenge, Westlands   
 1     Kenya Classic Homes                Kilimani, Dagoretti North   
 2  Absolute Estate Agents  Hatheru Rd,, Lavington, Dagoretti North   
 3   A1 Properties Limited                Kilimani, Dagoretti North   
 4     Pmc Estates Limited                    Imara Daima, Embakasi   
 
          Price                                               link  sq_mtrs  \
 0  KSh 155,000  /listings/4-bedroom-apartment-for-rent-general...      4.0   
 1  KSh 100,000  /listings/3-bedroom-apartment-for-rent-kiliman...    300.0   
 2   KSh 75,000  /listings/3-bedroom-apartment-for-rent-lavingt...      3.0   
 3  KSh 135,000  /listings/3-bedroom-apartment-for-rent-kiliman...    227.0   
 4   KSh 50,000  /listings/3-bedroom-apartment-for-rent-imara-d...      3.0   
 
    Bedrooms  Bathrooms  
 0       4.0        4.0  
 1       3.0        4.0  
 2       3.0        5.0  
 3       3.0        4.0  
 4       3.0        NaN  )
Creative Commons License

Editor: Zacharia Maganga Nyambu
Email: zachariamaganga@duck.com

No comments:

Meet the Authors
Zacharia Maganga’s blog features multiple contributors with clear activity status.
Active ✔
πŸ§‘‍πŸ’»
Zacharia Maganga
Lead Author
Active ✔
πŸ‘©‍πŸ’»
Linda Bahati
Co‑Author
Active ✔
πŸ‘¨‍πŸ’»
Jefferson Mwangolo
Co‑Author
Inactive ✖
πŸ‘©‍πŸŽ“
Florence Wavinya
Guest Author
Inactive ✖
πŸ‘©‍πŸŽ“
Esther Njeri
Guest Author
Inactive ✖
πŸ‘©‍πŸŽ“
Clemence Mwangolo
Guest Author

Followers

Support This Blog
Tap Donate now here to donate or go to donate on top menu to scan QR and support this site.
Donate Now