I have this question but I am getting this error

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

I have this question but I am getting this error

Post by answerhappygod »

I have this question
I Have This Question But I Am Getting This Error 1
I Have This Question But I Am Getting This Error 1 (55.66 KiB) Viewed 59 times
I Have This Question But I Am Getting This Error 2
I Have This Question But I Am Getting This Error 2 (63.64 KiB) Viewed 59 times
I Have This Question But I Am Getting This Error 3
I Have This Question But I Am Getting This Error 3 (95.99 KiB) Viewed 59 times
but I am getting this error
Scatter plot of exam mark versus test mark The file marks.csv contains students' marks from COSC131 in some year. It begins Modules, Assignments, Test, Exam 96.43,93.81,81.36,83.2 23.2, 18.8,0,62.8 61.16,24.83,54.55,35.2 97.24,99.76,67.73, 87.2 90.6,72.8,58.64,32 48.39,20.9,77.27,69 64.23, 29.1, 49.55,0 98.3,97.93,90.45, 86.8 94.69,93.04,81.82,75.6 96.62,94.05,77.27,83.2 73.4,62.8,72.27,66.4 95.83,95.57,85.91,87.6 82.26,46.21,67.73,54.4 90.12,99.73, 99.55,99.6 16.94, 16.93,22.27,62.8 73.72,52.2,62.27,56 Write a function plot_exam_versus_test(filename) that takes such a file and generates a scatter plot of exam marks versus test marks. With the given marks file, the plot should look exactly like the following:

COSC131: Exam versus Test 100 80 60 Exam 40 20 : . 20 40 60 80 100 Test Notes: • You are required to use the standard numpy plot function with markers (circles of the default size in the colour "green") and no lines. Do not use the numpy scatter function, which is in general less efficient and should be used only when you have a mixture of marker sizes and/or shapes in the same data set. • You are not allowed to use any loops, list comprehensions, or if statements in the function. • Your plot should have the title "COSC131: Exam versus Test", X-label "Test", and y-label "Exam". • You are allowed to make only one call to np. loadtxt.

Answer: 1 import numpy as np 2 import matplotlib.pyplot as plt 3def plot_exam_versus_test(): 4 5 6 marks = np.loadtxt('marks.csv', delimiter=',', skiprows=9, usecols=3) 7 axes = plt.axes() 8 axes.plot(label="Default - no markers") 9 axes.plot(color="green", marker="0", linestyle="") 10 axes.set_title("COSC131: Exam versus Test") 11 axes.set_xlabel('Test') 12 axes.set_ylabel('Exam') 13 plt.show 14 15 16 Cooo No UA B C N 1111 оол Check Got *** RUN TIME ERROR(S) *** Traceback (most recent call last): File "_source.py", line 31, in <module> plot_exam_versus_test('marks.csv') TypeError: plot_exam_versus_test() takes O position Expected Plot title: 'COSC131: Exam versus Test' X-axis label: 'Test' Y-axis label: 'Exam' (x, y) grid lines enabled: (False, False) Color: RGB(0.00, 0.50, 0.00) Marker: 0 Line style: None Num points: 568 First 5 points: (81.36, 83.20) (0.00, 62.80) (54.55, 35.20) (67.73, 87.20) (5964 22
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply