Cell #10

Code
  • ScountS14 = coll.Counter(ConfidenceS14.iloc[:,3])
    • Finds the data that deals with the student, and what school they attend
  • labels = list(set(ConfidenceS14.iloc[:,3])) n = len(labels)
    • list(set()) deals with sets, I’m assuming this takes the list of # under the labels and groups them as a set
    • len() keeps number of items in a list (number of data entries)
  • sizes = [] for i in range(0,n): sizes.append(ScountS14[labels[i]])
    • This line gives each “label” (school name) a size based on the percentage of kids that go to that school
    • The size depends on the length of the list set up in the previous line.
  • “Colors” and “explode” change the colors of the pie slices, and dictates whether or not the slice pops in 3D.
  • Changing the “startangle” number switches which colors represent which school
  • Deleted the part highlighted in red because before an error was showing up that said “Too many values to unpack.” Without this part the graph appears fine.
    • patches, text = plt.pie(sizes, colors=colors, autopct='%1.1f%%',shadow=True, startangle=200)
  • “loc=” dictates the orientation of the chart and the legend, “loc = [1,0]” looks the best

Notes

  • Having similar issues with explode as Torri
  • Is “Homeschool” and “Homeschooled” the same thing? They show up as different sections of the pie chart, but they sound similar.
  • Tried to make legend using image on Torri’s blog
  • Accidentally deleted cell 10 while trying to delete a line, then I clicked on the save button instead of the file button. Now the last checkpoint is without cell 10.
  • Deleted and then reuploaded files so all the cells are there.
  • Now I’m getting a pop up that says  “Unreadable Notebook: C:\Users\sweett\SienaSurveyConfidence.ipynb NotJSONError("Notebook does not appear to be JSON: u''...",)” and I can’t open the python code.
  • Deleted and uploaded again and it’s working now
  • How do I make the % appear again???

Comments

Popular posts from this blog

6/14/17 Notes

6/06/17 Notes (formatting code and searching for a specific person)

May 22, 2017 -- SienaSemanticsSurvey -- Code Breakdown -- Cell #8