I am attempting to split data2's text into two groups and create a box plot. I am unable to name values for the graph plot without an error. What is wrong in the code?
f2 = open("data2.txt", "r")
data2 = f2.read()
with open('data2.txt') as f2:
mental_disorders = f2.readlines()[0]
with open('data2.txt') as f2:
healthy_persons = f2.readlines()[1]
value1 = [mental_disorders]
value2=[healthy_persons]
box_plot_data=[value1,value2]
plt.boxplot(box_plot_data,patch_artist=True,labels=['Mental','Healthy'])
plt.show()