Sample data is collected in ExamScores.csv that includes scores in four exams in
ID: 3905335 • Letter: S
Question
Sample data is collected in ExamScores.csv that includes scores in four exams in a class. The variables are called Exam1, Exam2, Exam3, and Exam4. After ANOVA is performed on exam data, the professor is interested in plotting boxplots to identify the exam that has a significantly different average exam score. Which of the following Python lines can be used to complete this task?
Question options:
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_score = scores[['Exam1']]
exam2_score = scores[['Exam2']]
exam3_score = scores[['Exam3']]
exam4_score = scores[['Exam4']]
data = [exam1_score, exam2_score, exam3_score, exam4_score]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(data)
fig.savefig('test.png')
import pandas as pd
import matplotlib
matplotlib.use('agg')
import matplotlib as mpl
import matplotlib.pyplot as plt
scores = pd.read_csv('ExamScores.csv')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(scores)
fig.savefig('test.png')
import pandas as pd
import matplotlib
matplotlib.use('agg')
import matplotlib as mpl
import matplotlib.pyplot as plt
scores = pd.read_csv('ExamScores.csv')
exam1_score = scores[['Exam1']]
exam2_score = scores[['Exam2']]
exam3_score = scores[['Exam3']]
exam4_score = scores[['Exam4']]
data = [exam1_score, exam2_score, exam3_score, exam4_score]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(data)
fig.savefig('test.png')
import pandas as pd
scores = pd.read_csv('ExamScores.csv')
exam1_score = scores[['Exam1']]
exam2_score = scores[['Exam2']]
exam3_score = scores[['Exam3']]
exam4_score = scores[['Exam4']]
data = [exam1_score, exam2_score, exam3_score, exam4_score]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(data)
fig.savefig('test.png')
import pandas as pd
import matplotlib
matplotlib.use('agg')
import matplotlib as mpl
import matplotlib.pyplot as plt
scores = pd.read_csv('ExamScores.csv')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(scores)
fig.savefig('test.png')
import pandas as pd
import matplotlib
matplotlib.use('agg')
import matplotlib as mpl
import matplotlib.pyplot as plt
scores = pd.read_csv('ExamScores.csv')
exam1_score = scores[['Exam1']]
exam2_score = scores[['Exam2']]
exam3_score = scores[['Exam3']]
exam4_score = scores[['Exam4']]
data = [exam1_score, exam2_score, exam3_score, exam4_score]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(data)
fig.savefig('test.png')
Explanation / Answer
The second code is correct. Other two are giving error.
import pandas as pd
import matplotlib
matplotlib.use('agg')
import matplotlib as mpl
import matplotlib.pyplot as plt
scores = pd.read_csv('ExamScores.csv')
fig = plt.figure()
ax = fig.add_subplot(111)
ax.boxplot(scores)
fig.savefig('test.png')
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.