Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

COURSE TITLE: BUSINESS ANALYTICS-I

COURSE CODE: MGNM801 ACADEMIC TASK TYPE: INDIVIDUAL

ACADEMIC TASK: 02 DATE OF SUBMISSION: 23-12-23

DATE OF ALLOTMENT: GUIDED BY: PUNEET PAHADIA

NAME: Ritik REGISTRATION NO: 12308138

SECTION: Q2342 ROLL NO: RQ2342A30

Declaration:

I declare that this Assignment is my individual work. I have not copied it from any other student’s work or
from any other source except where due acknowledgement is made explicitly in the text, nor has any part
been written for me by any other person.

EVALUATOR’S COMMENTS (FOR INSTRUCTOR’S USE ONLY)

GENERAL OBSERVATIONS SUGGESTIONS FOR BEST PART OF ASSIGNMENTS


IMPROVEMENT

EVALUATOR’S SIGNATURE AND DATE

MARKS OBTAINED - ____________ MAX. MARKS - ___________


I. CALCULATOR USING OPERATORS AND IF ELSE STATEMENTS
Following is the code used to make a calculator in python:

while True:
try:
num1 = float(input("Enter first number: "))
operator = input("Enter operator (+, -, *, /): ")
num2 = float(input("Enter second number: "))

if operator == "+":
result = num1 + num2
elif operator == "-":
result = num1 - num2
elif operator == "*":
result = num1 * num2
elif operator == "/":
if num2 == 0:
raise ZeroDivisionError("Cannot divide by zero")
result = num1 / num2
else:
print("Invalid operator")
continue

print(f"{num1} {operator} {num2} = {result}")


break

except ValueError:
print("Invalid input. Please enter numbers only.")
except ZeroDivisionError as e:
print(e)
II. SALES ANALYSIS
Following is the sales analysis of a data of Super Market.

1. Pie Chart: Below is an analysis on vegetables based on the data collected, determining the percentage
that each type of vegetable adds to the overall sales.

Code:

1. plt.figure(figsize=(9,9))
2. plt.pie(category_name_wise_sales['total_sales'],labels=category_name_wise_s
ales['Category Name'], autopct='%1.0f%%', colors='viridis')
3. plt.title('Pie Chart')
4. plt.show()
2.Bar Graph: Below is a bar graph analysis on vegetables based on the data collected, determining the
percentage that each type of vegetable adds to the overall sales.

Insights:

plt.figure(figsize=(20,8))
sns.barplot(x='Category
Name',y='total_sales',data=category_name_wise_sales,palette="dark")
plt.xticks(rotation=45, ha='right')
plt.xlabel('Category Name')
plt.ylabel('Total Sales')
plt.title('category_name_wise_sales')
plt.show()
III) PLACEMENT DATA ANALYSIS AND INSIGHTS

1. Check the first four rows of the dataframe

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
placement=pd.read_csv(r"c:\AASHISH\Placement_Data.csv")
data=pd.DataFrame(placement)

print(data.head(4))

2. Get all feature names

print(data.columns)

3. Find the number of records and columns

print(data.shape)

output = (215, 15)


4. Use the .info() method to find the number of Non Null entries and Data Type of each feature

print(data.info())

5. What is the average Secondary Education percentage - 10th Grade

print(data['ssc_p'].mean())
Output: 67.30339534883721

6. What is the max Secondary Education percentage - 10th Grade

print(data['ssc_p'].max())

Output: 89.4

7. How many toppers where there in 10th Grade?

print(data[data['ssc_p'] == data['ssc_p'].max()].shape[0])
Output: 1

8. Is the student who got highest Secondary Eduaction percentage, placed or not?

print(data[data['ssc_p'] == data['ssc_p'].max()]['status'].values[0])

Output: Placed
9. How many students are placed or unplaced?

print(data['status'].value_counts())

Output:

status

Placed 148

Not Placed 67

Name: count, dtype: int64

10. How many unique degrees are there in the dataset?

print(data['degree_t'].nunique())

Output : 3

11. Is there a correlation between 10th and 12th percentage

print(data['ssc_p'].corr(data['hsc_p']))
Output: 0.5114721015997723

12. Find the correlation matrix?

numeric_columns = data.select_dtypes(include=['int64', 'float64'])

correlation_matrix = numeric_columns.corr()
print(correlation_matrix)
Output:
Data Pre-processing

13. Identify the column which can be removed?(only 1)

column_to_remove = 'sl_no'

14. Remove the unnecessary column

column_to_remove = 'sl_no'

data = data.drop(columns=[column_to_remove])
print(data)

15. Check number of null values in each column

print(data.isnull().sum())
Output:
gender 0
ssc_p 0
ssc_b 0
hsc_p 0
hsc_b 0
hsc_s 0
degree_p 0
degree_t 0
workex 0
etest_p 0
specialisation 0
mba_p 0
status 0
salary 67
dtype: int64

16. Fill the missing values with appropriate values and check number of null values in each column
again

data["salary"].fillna(data["salary"].mean())

17. Draw a scatter plot between 10th and 12th percentage with labels and title

plt.figure(figsize=(8, 6))
sns.scatterplot(x='ssc_p', y='hsc_p', data=data,color='b')
plt.title('Scatter Plot between 10th and 12th Percentage')
plt.xlabel('10th Percentage')
plt.ylabel('12th Percentage')
plt.show()
18. Draw the scatter plot between 10th and 12th class percentage of students grouped based on
placement data

plt.figure(figsize=(8, 6))
sns.scatterplot(x='ssc_p', y='hsc_p', hue='status', data=data)
plt.title('Scatter Plot between 10th and 12th Percentage (Grouped by Placement)')
plt.xlabel('10th Percentage')
plt.ylabel('12th Percentage')
plt.show()
19 . Draw a boxplot for 10th percentage of the students

plt.figure(figsize=(8, 6))
sns.boxplot(x='ssc_p', data=data,color='g')
plt.title('Boxplot for 10th Percentage')
plt.xlabel('10th Percentage')
plt.show()
20. Draw a boxplot for 12th percentage of the students

plt.figure(figsize=(8, 6))
sns.boxplot(x='hsc_p', data=data,color='g')
plt.title('Boxplot for 12th Percentage')
plt.xlabel('12th Percentage')
plt.show()

21. Draw a boxplot for 12th percentage of the students for placed and unplaced students

plt.figure(figsize=(10, 6))
sns.boxplot(x='status', y='hsc_p', data=data)
plt.title('Boxplot for 12th Percentage (Placed vs. Unplaced)')
plt.xlabel('Placement Status')
plt.ylabel('12th Percentage')
plt.show()
22. Draw lineplot for 10th, 12th, degree and MBA percentage

plt.figure(figsize=(15, 9))
sns.lineplot(data=data[['ssc_p', 'hsc_p', 'degree_p', 'mba_p']])
plt.title('Lineplot for 10th, 12th, Degree, and MBA Percentage')
plt.xlabel('Student')
plt.ylabel('Percentage')
plt.legend(['10th', '12th', 'Degree', 'MBA'])
plt.show()
23. Find correlation between continous columns

correlation_continuous = data[['ssc_p', 'hsc_p', 'degree_p', 'mba_p']].corr()

24. Draw heatmap of correlation

plt.figure(figsize=(8, 6))
sns.heatmap(correlation_continuous, annot=True, cmap='coolwarm')
plt.title('Heatmap of Correlation')
plt.show()

You might also like