{ "cells": [ { "cell_type": "markdown", "id": "86625251", "metadata": {}, "source": [ "# Assignment 4: EDA - Correlation Analysis\n", "Perform correlation analysis on a dataset of car features and prices.\n", "Calculate correlation matrix and plot a heatmap." ] }, { "cell_type": "code", "execution_count": null, "id": "d3ae5847", "metadata": {}, "outputs": [], "source": [ "import pandas as pd\n", "import seaborn as sns\n", "import matplotlib.pyplot as plt\n", "\n", "# Synthetic dataset\n", "data = {\n", " 'horsepower': [120, 150, 100, 180],\n", " 'weight': [3000, 3200, 2800, 3500],\n", " 'price': [20000, 25000, 18000, 30000]\n", "}\n", "df = pd.DataFrame(data)\n", "\n", "# Correlation matrix\n", "corr_matrix = df.corr()\n", "\n", "# Plot heatmap\n", "sns.heatmap(corr_matrix, annot=True)\n", "plt.title('Correlation Heatmap')\n", "plt.show()\n", "\n", "# Error: Incorrect column name\n", "print(df['Price'])" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }