0% found this document useful (0 votes)
4 views2 pages

AMLW Assignment 2

Uploaded by

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

AMLW Assignment 2

Uploaded by

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

Centre for Artificial Intelligence Machine Learning

Institute of Technical Education & Research, SOA, Deemed to be University

Applied Machine Learning Workshop (CSE 3193)


A SSIGNMENT-2: C RASH C OURSE ON N UMPY AND M ATPLOTLIB

1. Write a Python program to create an empty array of 3X4 and a full array of 3X3 of integer and float
type in Numpy.
2. Write a Python program to test whether none of the elements of a given array is zero.
3. Write a Python program in Numpy to create a matrix of 4 X 6 dimensions where the element at ith
row and j th column is the sum of i+j.
4. Use arange to create a 2-by-2 array containing the numbers 0–3.
a) Cube every element of the array.
b) Add 7 to every element of the array.
c) Multiply every element of the array by 2. Use broadcasting to perform each of the following
operations on the original array:
5. Write a Python program in Numpy to create a multiplication table for numbers 1 to 10.
6. Write a Python program to create an array with zero and non-zero elements using Numpy and count
the number of non-zero elements in the array.
7. Write a Python program to generate 50 numbers from 20 to 100 with equally spaced numbers and 20
integer numbers from 20 to 100.
8. Write a Python program to print all the even numbers from 2 to 10, including 2 and 10, with and
without using Numpy functions.
9. Write a Python program to input three integer arrays and perform addition, multiplication, subtraction,
and division of all elements of the inputted array.
10. Write a Python program to input a random array and find the sum and average of all array elements.
11. Write a Python program to input a dimension 4 X 5 matrix, add 4 to all matrix elements, and reshape
the matrix to 2 X 10.
12. Plot a line graph to show the company’s sales data and profit for all months using the data given below.
Month=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

Profit=[211000, 183300, 224700, 222700, 209600, 201400, 295500, 361400, 234000, 266700, 412800,
300200]
13. Write a Python program to display the grid and draw line charts of the closing value of a company
between October 3, 2017, and October 7, 2017. Customized the grid lines with linestyle -, width .5
and color is blue.
data = [’3 Aug’, ’4-Aug’, ’5-Aug’, ’6-Aug’, ’7-Aug’]
value=[772.559998, 776.429993, 776.859985, 776.859985, 775.080017]
14. Write a Python program to display a bar chart of the popularity of programming languages with a
different color for each bar.
Sample data:
Programming languages: [’Java’, ’Python’, ’PHP’, ’JavaScript’, ’C Sharp’, ’C++’]
Popularity: [22.2, 17.6, 8.8, 8, 7.7, 6.7]
1
Centre for Artificial Intelligence Machine Learning
Institute of Technical Education & Research, SOA, Deemed to be University

15. Write a Python program to create a bar plot of scores by group and gender. Use multiple X values on
the same chart for men and women.
Sample Data:
Means (men) = (22, 30, 35, 35, 26)
Means (women) = (25, 32, 30, 35, 29)
Popularity: [22.2, 17.6, 8.8, 8, 7.7, 6.7]

16. Write a Python program to draw a scatter plot comparing two Mathematics and Science subject marks.
Use marks of 10 students.
Test Data:
math marks = [88, 92, 80, 89, 100, 80, 60, 100, 80, 34]
science marks = [35, 79, 79, 48, 100, 88, 32, 45, 20, 30]
marks range = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]

17. Plot the temperature extremes in certain regions of India for each month, starting in January, which
are given by (in degrees Celsius).
max: 17, 19, 21, 28, 33, 38, 37, 37, 31, 23, 19, 18
min: -62, -59, -56, -46, -32, -18, -9, -13, -25, -46, -52, -58

18. Plot histogram with the number of bins=10 and color to green for the given data below:
data = [32, 96, 45, 67, 76, 28, 79, 62, 43, 81, 70, 61, 95, 44, 60, 69, 71, 23, 69, 54, 76, 67, 82, 97, 26,
34, 18, 16, 59, 88, 29, 30, 66, 23, 65, 72, 20, 78, 49, 73, 62, 87, 37, 68, 81, 80, 77, 92, 81, 52, 43, 68,
71, 86,87,98,95]

19. Plot histograms for the male and female ages in different plots for the following data on male and
female age.
male age = [53,51,71,31,33,39,52,27,54,30,64,26,21,54,52,20,59,32]
female age = [53,65,68,21,75,46,24,63,61,24,49,41,39,40,25,54,42, 32,48,23,23]

20. Plot sinx, xsinx, cosx, and tanx in a single 2 X 2 subplot grid in the range of x ∈ [10, 10] for 50
values of x.

You might also like