a
a
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import OneHotEncoder
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error, mean_squared_error, r2_score
# Load the dataset from CSV file named "house.csv" into a pandas DataFrame
df = pd.read_csv("house.csv")
# Check the DataFrame to see if there are any duplicate records and print the value
duplicates = df.duplicated().sum()
print(f"Number of duplicate records: {duplicates}")
# Drop unnecessary fields (House_Id in this case) and determine the features and
the target fields
df = df.drop(columns=["House_Id"])
features = ['Area', 'Bedrooms', 'Bathrooms', 'Neighborhood']
target = 'Price'
# Make predictions
y_pred = model.predict(X_test)
# Find the house with the highest number of bedrooms and print its neighborhood
max_bedrooms_house = df[df['Bedrooms'] == df['Bedrooms'].max()]
print(f"Neighborhood of the house with the most bedrooms:
{max_bedrooms_house['Neighborhood'].values}")