This project aims to analyze customer data and identify distinct customer segments based on their annual income and spending score. The analysis involves data loading, exploration, visualization, scaling, and clustering using the KMeans algorithm.
- Customers.csv: Dataset containing customer information.
- Customer_Segmentation.ipynb: Jupyter Notebook containing the code for data analysis and segmentation.
numpyfor numerical operations.pandasfor data manipulation.matplotlibandseabornfor data visualization.mpl_toolkitsfor additional tools in plotting.MinMaxScalerfromsklearn.preprocessingfor feature scaling.
- Loaded the dataset using
pd.read_csv. - Renamed the 'Genre' column to 'Gender'.
- Checked the shape of the dataframe (200 rows, 5 columns).
- Checked the data types of each column.
- Checked for any missing values (none found).
- Dropped the 'CustomerID' column as it does not contribute to the analysis.
- Created a scatter plot between 'Annual Income' and 'Spending Score' to visualize the distribution of customers.
- Performed feature scaling using
MinMaxScalerto bring all features to a common scale.
- Utilized the KMeans algorithm to develop clusters based on customer features.
- Applied the algorithm to the scaled data.
- Visualized the clusters on the scatter plot.
- Install the required libraries using:
pip install numpy pandas matplotlib seaborn scikit-learn. - Open the
Customer_Segmentation.ipynbnotebook in Jupyter or any compatible environment. - Execute the cells in sequential order to reproduce the analysis.
Feel free to modify the code to suit your needs or explore additional analyses.
Happy clustering!