def reshape(self, students, questions, scores, q_ratings=None): self.df.reset_index(inplace=True) if q_ratings != None: self.q_ratings = pd.DataFrame(self.df.pivot_table(index=questions, values=q_ratings)) self.q_ratings.columns= ['difficulty rating']
self.df = self.df.pivot_table(index=students, columns=questions, values=scores) object1.reshape(self.df['student_id'],self.df.index,self.df['score'],self.df['question_rating']) On calling this function, the following error occurs : File "C:\Users\sony\Anaconda2\lib\site-packages\pandas\core\generic.py", line 731, in __nonzero__ .format(self.__class__.__name__)) ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all(). The value in dataframe is all in integers. It also have repetitive values of index. Attached : CSV data -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/14914313-7f44-49cd-a49a-8d7d2b04e60a%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.