Advertisement
Guest User

Python_And_Templates

a guest
Aug 23rd, 2023
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.62 KB | None | 0 0
  1. Here is the data:
  2. QuestionID  QuestionStem    QuestionOrder   AnswerId    AnswerText  AnswerOrder isCorrect   Class   Date
  3.  
  4. 100 What color is the sky?  0   11  Red     0   0   Astro 101   2023-08-23
  5. 100 What color is the sky?  0   11  Green   1   0   Astro 101   2023-08-23
  6. 100 What color is the sky?  0   11  Gold    2   0   Astro 101   2023-08-23
  7. 100 What color is the sky?  0   11  Blue    3   1   Astro 101   2023-08-23
  8.  
  9. And the only code change I made to your answer is this:
  10.  
  11.     # Get data from SQL Server and put into a pandas dataframe
  12.     df = pd.read_sql_query(qry, engine)
  13.  
  14.     # Iterate over the dataframe rows
  15.     for exam in Exam.from_data(df.values.tolist()):
  16.         print(exam)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement