Assignment
Assignment
-Python Programming-
ALGORITHM:
1. Load CSV dataset.
2. Display the first 5 rows of the data.
3. Check for and display the missing values in each column.
4. Remove rows with missing values.
5. Display summary statistics of the cleaned data.
6. Save the cleaned data to a new file name.
PROGRAM:
OUTPUT:
AIM:
Using Pandas, create a DataFrame to store employee details (ID, Name,
Salary). Write a function to filter employees earning above a given salary
and plot their salaries.
ALGORITHM:
1. The DataFrame is created with sample employee data (IDs, Names, and
Salaries).
2. The employees with a salary greater than 60,000 are filtered and
displayed.
3. A bar chart is plotted to visualize employees with salaries above 60,000.
PROGRAM:
OUTPUT:
AIM:
Write a Python program to check for duplicate rows in a DataFrame and
remove them.
ALGORITHM:
1. The CSV file is loaded.
2. The DataFrame is printed to show the original data.
3. The program identifies any duplicate rows in the DataFrame and displays
them.
4. If there are no duplicates, it reports this to the user.
5. All duplicate rows are removed, and the cleaned DataFrame is printed.
6. The cleaned DataFrame is saved as cleaned_dataset.csv, and the file save
location is displayed.
PROGRAM:
OUTPUT:
AIM:
Write a Python program to create a line plot and a bar chart using Matplotlib for
sales data over the last 12 months.
ALGORITHM:
1. Load the CSV file
2. It checks if the necessary columns ('Month' and 'Sales') are present in the
data. If not, an error message is shown.
3. Display the data that is loaded.
4. Plot the line to visualize sales over the months.
5. Plot the bar chart to display the same data in a different format.
PROGRAM:
OUTPUT:
AIM:
Using Seaborn, create a heatmap to visualize correlations in a Pandas
DataFrame.
ALGORITHM:
1. Load the CSV dataset.
2. Compute the correlation using df.corr() to measure the relationship
between the numerical features of the dataset.
3. Print the Correlation matrix.
4. Generate and display the heatmap.
PROGRAM:
OUTPUT:
AIM:
Plot a scatter plot with a regression line using Seaborn for a dataset
containing age and salary columns.
ALGORITHM:
1. Read the data from the CSV file.
2. Check if the 'Age' and 'Salary' columns are present in the dataset. If either
is missing, an error message is shown.
3. Plot scatter plot with regression lines using seaborn.
4. Display the plot with scatter points and regression lines.
PROGRAM:
OUTPUT: