help@rskworld.in +91 93305 39277
RSK World
  • Home
  • Development
    • Web Development
    • Mobile Apps
    • Software
    • Games
    • Project
  • Technologies
    • Data Science
    • AI Development
    • Cloud Development
    • Blockchain
    • Cyber Security
    • Dev Tools
    • Testing Tools
  • Blog
  • About
  • Contact

Theme Settings

Color Scheme
Display Options
Font Size
100%
Back to Project
RSK World
housing-prices
RSK World
housing-prices
Housing Price Prediction Dataset - Real Estate ML + Price Prediction AI + Housing Price Deep Learning
housing-prices
  • __pycache__
  • .gitignore714 B
  • ADVANCED_FEATURES.md5.2 KB
  • LICENSE.txt1.5 KB
  • PROJECT_STRUCTURE.txt4.3 KB
  • README.md5.1 KB
  • advanced_models.py10.3 KB
  • data_analysis.py3.3 KB
  • data_visualization.py5.3 KB
  • dataset_info.txt3.5 KB
  • feature_engineering.py9.5 KB
  • housing_price_prediction.ipynb9.4 KB
  • housing_prices.csv4.8 KB
  • housing_prices.json23.7 KB
  • hyperparameter_tuning.py9.9 KB
  • index.html11.2 KB
  • model_comparison.py8.1 KB
  • predict_price.py4.6 KB
  • requirements.txt620 B
  • test_project.py6.8 KB
  • validate_data.py2.7 KB
validate_data.pydata_visualization.py
validate_data.py
Raw Download
Find: Go to:
"""
Housing Price Prediction Dataset - Data Validation Script
RSK World - Free Programming Resources & Source Code
Website: https://rskworld.in
Contact: help@rskworld.in, support@rskworld.in
Phone: +91 93305 39277
Founder: Molla Samser
Designer & Tester: Rima Khatun
Created: 2026
"""

import pandas as pd
import json
import os

def validate_csv():
    """Validate CSV file"""
    print("Validating CSV file...")
    try:
        df = pd.read_csv('housing_prices.csv')
        print(f"[OK] CSV file loaded successfully")
        print(f"  - Shape: {df.shape}")
        print(f"  - Columns: {len(df.columns)}")
        print(f"  - Missing values: {df.isnull().sum().sum()}")
        print(f"  - Price range: ${df['price'].min():,.0f} - ${df['price'].max():,.0f}")
        return True
    except Exception as e:
        print(f"[ERROR] Error validating CSV: {e}")
        return False

def validate_json():
    """Validate JSON file"""
    print("\nValidating JSON file...")
    try:
        with open('housing_prices.json', 'r') as f:
            data = json.load(f)
        print(f"[OK] JSON file loaded successfully")
        print(f"  - Records: {len(data)}")
        print(f"  - First record keys: {list(data[0].keys())}")
        return True
    except Exception as e:
        print(f"[ERROR] Error validating JSON: {e}")
        return False

def check_required_files():
    """Check if all required files exist"""
    print("\nChecking required files...")
    required_files = [
        'housing_prices.csv',
        'housing_prices.json',
        'data_analysis.py',
        'data_visualization.py',
        'housing_price_prediction.ipynb',
        'advanced_models.py',
        'feature_engineering.py',
        'hyperparameter_tuning.py',
        'model_comparison.py',
        'predict_price.py',
        'README.md',
        'requirements.txt',
        'index.html'
    ]
    
    all_exist = True
    for file in required_files:
        if os.path.exists(file):
            print(f"[OK] {file}")
        else:
            print(f"[MISSING] {file}")
            all_exist = False
    
    return all_exist

def main():
    print("="*60)
    print("Housing Price Prediction Dataset - Validation")
    print("RSK World - Free Programming Resources & Source Code")
    print("="*60)
    
    csv_ok = validate_csv()
    json_ok = validate_json()
    files_ok = check_required_files()
    
    print("\n" + "="*60)
    if csv_ok and json_ok and files_ok:
        print("[SUCCESS] All validations passed!")
        print("Dataset is ready to use.")
    else:
        print("[FAILED] Some validations failed. Please check the errors above.")
    print("="*60)

if __name__ == "__main__":
    main()

95 lines•2.7 KB
python
data_visualization.py
Raw Download
Find: Go to:
"""
Housing Price Prediction Dataset - Data Visualization Script
RSK World - Free Programming Resources & Source Code
Website: https://rskworld.in
Contact: help@rskworld.in, support@rskworld.in
Phone: +91 93305 39277
Founder: Molla Samser
Designer & Tester: Rima Khatun
Created: 2026
"""

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns

# Set style for better-looking plots
sns.set_style("whitegrid")
plt.rcParams['figure.figsize'] = (12, 8)

# Load the dataset
print("Loading housing prices dataset for visualization...")
df = pd.read_csv('housing_prices.csv')

# Create output directory for plots
import os
os.makedirs('plots', exist_ok=True)

# 1. Price Distribution
print("Creating price distribution plot...")
plt.figure(figsize=(10, 6))
plt.hist(df['price'], bins=30, edgecolor='black', alpha=0.7)
plt.xlabel('Price ($)')
plt.ylabel('Frequency')
plt.title('Distribution of House Prices')
plt.ticklabel_format(style='plain', axis='x')
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('plots/price_distribution.png', dpi=300, bbox_inches='tight')
plt.close()

# 2. Correlation Heatmap
print("Creating correlation heatmap...")
numeric_cols = df.select_dtypes(include=[np.number]).columns
corr_matrix = df[numeric_cols].corr()

plt.figure(figsize=(14, 10))
sns.heatmap(corr_matrix, annot=True, fmt='.2f', cmap='coolwarm', center=0,
            square=True, linewidths=1, cbar_kws={"shrink": 0.8})
plt.title('Correlation Heatmap of Housing Features')
plt.tight_layout()
plt.savefig('plots/correlation_heatmap.png', dpi=300, bbox_inches='tight')
plt.close()

# 3. Price vs Square Feet Living
print("Creating price vs square feet living plot...")
plt.figure(figsize=(10, 6))
plt.scatter(df['sqft_living'], df['price'], alpha=0.5, edgecolors='black', linewidth=0.5)
plt.xlabel('Square Feet Living')
plt.ylabel('Price ($)')
plt.title('Price vs Square Feet Living')
plt.ticklabel_format(style='plain', axis='y')
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('plots/price_vs_sqft_living.png', dpi=300, bbox_inches='tight')
plt.close()

# 4. Price vs Number of Bedrooms
print("Creating price vs bedrooms plot...")
plt.figure(figsize=(10, 6))
bedroom_avg_price = df.groupby('bedrooms')['price'].mean()
plt.bar(bedroom_avg_price.index, bedroom_avg_price.values, edgecolor='black', alpha=0.7)
plt.xlabel('Number of Bedrooms')
plt.ylabel('Average Price ($)')
plt.title('Average Price by Number of Bedrooms')
plt.ticklabel_format(style='plain', axis='y')
plt.grid(True, alpha=0.3, axis='y')
plt.tight_layout()
plt.savefig('plots/price_vs_bedrooms.png', dpi=300, bbox_inches='tight')
plt.close()

# 5. Price vs Location (Latitude/Longitude)
print("Creating price vs location plot...")
plt.figure(figsize=(12, 8))
scatter = plt.scatter(df['long'], df['lat'], c=df['price'], 
                     cmap='viridis', alpha=0.6, s=100, edgecolors='black', linewidth=0.5)
plt.colorbar(scatter, label='Price ($)')
plt.xlabel('Longitude')
plt.ylabel('Latitude')
plt.title('House Prices by Geographic Location')
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('plots/price_by_location.png', dpi=300, bbox_inches='tight')
plt.close()

# 6. Price vs Grade
print("Creating price vs grade plot...")
plt.figure(figsize=(10, 6))
grade_avg_price = df.groupby('grade')['price'].mean()
plt.plot(grade_avg_price.index, grade_avg_price.values, marker='o', 
         linewidth=2, markersize=8, color='steelblue')
plt.fill_between(grade_avg_price.index, grade_avg_price.values, alpha=0.3)
plt.xlabel('Grade')
plt.ylabel('Average Price ($)')
plt.title('Average Price by House Grade')
plt.ticklabel_format(style='plain', axis='y')
plt.grid(True, alpha=0.3)
plt.tight_layout()
plt.savefig('plots/price_vs_grade.png', dpi=300, bbox_inches='tight')
plt.close()

# 7. Feature Distribution
print("Creating feature distribution plots...")
fig, axes = plt.subplots(2, 3, figsize=(18, 12))
fig.suptitle('Distribution of Key Features', fontsize=16, y=1.02)

features_to_plot = ['bedrooms', 'bathrooms', 'sqft_living', 'floors', 'condition', 'grade']
for idx, feature in enumerate(features_to_plot):
    row = idx // 3
    col = idx % 3
    axes[row, col].hist(df[feature], bins=20, edgecolor='black', alpha=0.7, color='steelblue')
    axes[row, col].set_xlabel(feature)
    axes[row, col].set_ylabel('Frequency')
    axes[row, col].set_title(f'Distribution of {feature}')
    axes[row, col].grid(True, alpha=0.3)

plt.tight_layout()
plt.savefig('plots/feature_distributions.png', dpi=300, bbox_inches='tight')
plt.close()

# 8. Price by Neighborhood (Top 10)
print("Creating price by neighborhood plot...")
neighborhood_avg = df.groupby('neighborhood')['price'].mean().sort_values(ascending=False).head(10)
plt.figure(figsize=(12, 6))
plt.barh(range(len(neighborhood_avg)), neighborhood_avg.values, edgecolor='black', alpha=0.7)
plt.yticks(range(len(neighborhood_avg)), neighborhood_avg.index)
plt.xlabel('Average Price ($)')
plt.title('Top 10 Neighborhoods by Average Price')
plt.ticklabel_format(style='plain', axis='x')
plt.gca().invert_yaxis()
plt.grid(True, alpha=0.3, axis='x')
plt.tight_layout()
plt.savefig('plots/price_by_neighborhood.png', dpi=300, bbox_inches='tight')
plt.close()

print("\nAll visualizations saved to 'plots' directory!")
print("Visualization complete!")

149 lines•5.3 KB
python

About RSK World

Founded by Molla Samser, with Designer & Tester Rima Khatun, RSK World is your one-stop destination for free programming resources, source code, and development tools.

Founder: Molla Samser
Designer & Tester: Rima Khatun

Development

  • Game Development
  • Web Development
  • Mobile Development
  • AI Development
  • Development Tools

Legal

  • Terms & Conditions
  • Privacy Policy
  • Disclaimer

Contact Info

Nutanhat, Mongolkote
Purba Burdwan, West Bengal
India, 713147

+91 93305 39277

hello@rskworld.in
support@rskworld.in

© 2026 RSK World. All rights reserved.

Content used for educational purposes only. View Disclaimer