0% found this document useful (0 votes)
2 views

Assignment 8py

The document outlines an assignment consisting of various tasks related to NumPy, Pandas, and Matplotlib. It includes creating and manipulating arrays, performing statistical analysis, handling DataFrames, and generating visualizations. The tasks are designed to enhance skills in data manipulation and analysis using Python libraries.

Uploaded by

chiragkaushal10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Assignment 8py

The document outlines an assignment consisting of various tasks related to NumPy, Pandas, and Matplotlib. It includes creating and manipulating arrays, performing statistical analysis, handling DataFrames, and generating visualizations. The tasks are designed to enhance skills in data manipulation and analysis using Python libraries.

Uploaded by

chiragkaushal10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment 7

NumPy-Based Questions

1. Array Creation and Manipulation:


o Create a NumPy array of random integers between 10 and 100 with shape (5,
5). Perform the following operations:
 Replace all even numbers with -1.
 Calculate the sum of each row and column.
 Normalize the array (scale values between 0 and 1).
2. Statistical Analysis:
o Generate a 1D NumPy array with 100 random floating-point numbers between
0 and 1.
o Find the mean, median, variance, and standard deviation of the array.
o Identify and replace any values below 0.2 with the mean value.
3. Matrix Operations:
o Create two 3x3 matrices using random integers and perform the following:
 Matrix addition, subtraction, and multiplication.
 Calculate the determinant and inverse of one of the matrices.

Pandas-Based Questions

4. DataFrame Creation and Manipulation:


o Create a DataFrame with the following columns: Name, Age, Department, and
Salary for 10 employees.
 Add a new column for Bonus calculated as 10% of the Salary.
 Filter employees with a Salary greater than 50,000.
 Sort the DataFrame by Salary in descending order.
5. CSV File Handling:
o Download a dataset (e.g., Iris, Titanic, or create a mock dataset) in CSV
format.
 Read the CSV file into a Pandas DataFrame.
 Display basic statistics of the dataset (mean, median, etc.).
 Handle missing values by filling them with the column mean.
6. Grouping and Aggregation:
o Using the same employee dataset:
 Group employees by Department and calculate the average salary for
each department.
 Identify the department with the highest average salary.
 Plot the salary distribution of employees in different departments.

Matplotlib-Based Questions

7. Data Visualization:
o Create a line plot showing the growth of a company's revenue over the last 12
months.
 Add labels, title, and legend to the plot.
 Highlight the month with the maximum revenue using an annotation.
8. Bar Chart and Pie Chart:
o Using the employee dataset, create:
 A bar chart showing the number of employees in each department.
 A pie chart representing the percentage distribution of employees
across departments.
9. Histogram and Scatter Plot:
o Generate random data for students' test scores in two subjects (e.g., Math and
Science).
 Plot a histogram of scores for each subject.
 Create a scatter plot to analyze the correlation between Math and
Science scores. Add a trendline.

Integrated Questions (NumPy, Pandas, Matplotlib)

10. Weather Data Analysis:


o Generate a mock dataset for daily temperatures over a month using NumPy.
o Create a Pandas DataFrame with columns Day, Temperature, and Humidity.
o Perform the following:
 Identify the day with the highest temperature.
 Calculate the average temperature and humidity.
 Visualize the temperature trends over the month using a line plot.

You might also like