5/31/17 Notes (Trying to get a chart appear)

Notes
I wrote a list of what I want the new code to do in order to help me think of what order I need to write each command in. The first portion of the new code will be mostly copy and paste commands from the original code, with the addition of the appends code Torri mentioned. I’m going to attempt simply adding the student information to the confidence survey information to make sure that runs smoothly before I try anything fancy. (Things I did that worked are in blue to find them easily for future reference)
  1. Define terms
  2. Import packages
  3. Bring up survey results
  4. Delete duplicate survey responses
  5. Change formatting of survey results (invert #s of some responses and display questions as column headers)
  6. Append student info to new list of survey results so that code matches up identical names
    1. Get python to also match the survey year with the sheet that has student info for that year

  • Would it be easier to have the full names of students in one cell instead of having the code matchup two sets of two identical cells, it would match up two sets of one identical cell? (keeping this in mind for when we get to the point where we’re trying to match up identical names)
  • The code I am typing for the first cell keeps giving me errors, even though I am mimicking the format of the code that analyzes the surveys.
    • I’m going to try to move on the the next cell to see if the errors fix themselves with the addition of the information of the new cell
      • Did not work
    • I copied and pasted the original code, and then edited it so that it would only show what i needed.
      • This worked!
  • Opening specific sheet in file:
    • for name, sheet_name in zip(filename, sheetnumber): book = xlrd.open_workbook(name) sheet = book.sheet_by_name(sheet_name) for row in range(sheet.nrows): for column in range(sheet.ncols): if sheet.cell(row,column).value == value: print row, column
  • Opening Excel files:
    • import pandas as pd xl = pd.ExcelFile(path + filename) xl.sheet_names >>> [u'Sheet1', u'Sheet2', u'Sheet3'] df = xl.parse("Sheet1") df.head()
  • The original code has it so that questions and names are displayed separately so I will need to make a list of question answers, and names, then combine those two lists before I add the student information to that list
    • Indexing should be easier.
    • The command “ConfindenceS14.loc[:,[1,26]] did not work.
    • Typing the names of each column worked!
  • Indexing worked but only for some questions, the answers to some are appearing as “NaN.”
    • Tried fixing phrases in (in file and in code) with weird symbols instead of letters (Did not work)
    • Tried shutting everything down, turning my computer off and then turning it on again (Did not Work)
    • Tried deleting the code and retyping it (Did not work)
    • Tried inverting answers, then displaying chart again, I am getting an error claiming that one of my columns doesn’t actually exist, this column also isn’t appearing in the cart made in the earlier cell.
      • I am going to delete this column and see if that changes anything. This just continued to tell me that the columns did not exist
    • I opened up a new notebook and retyped the code except this time I renamed all the columns, then I made a new chart. This worked!
  • I tried inverting the #s to the responses of some questions on the new notebook, and I am still getting an error that says the “I do not think I will be successful in STEM” column does not exist.
    • Tried making the code display all the information, not just the changed questions, this did not work.
    • Tried replacing the “” that came after the “Fchange” part of the function with ‘’. This did not work.
    • Tried typing the numerical values for the columns instead of their labels. This did not work.

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