Comparaison des files Python Pandas Two Excel

Je crée une application Tkinter pour une comparaison de deux files excel pour suivre les modifications. Je suis confronté à un problème lorsque la comparaison des données se produit entre les valeurs NaN et Ssortingng / Numeric. Voici le code ci-dessous

Erreur:

Exception in Tkinter callback Traceback (most recent call last): File "C:\Python27\lib\lib-tk\Tkinter.py", line 1536, in __call__ return self.func(*args) File "C:/Excel_Comparator.py", line 82, in Excelcomparator different = (a0 != a1) File "C:\Python27\lib\site-packages\pandas\core\ops.py", line 1290, in f return self._compare_frame(other, func, str_rep) File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 3656, in _compare_frame return self._compare_frame_evaluate(other, func, str_rep) File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 3636, in _compare_frame_evaluate new_data = expressions.evaluate(_compare, str_rep, self, other) File "C:\Python27\lib\site-packages\pandas\computation\expressions.py", line 210, in evaluate **eval_kwargs) File "C:\Python27\lib\site-packages\pandas\computation\expressions.py", line 63, in _evaluate_standard return op(a, b) File "C:\Python27\lib\site-packages\pandas\core\frame.py", line 3634, in _compare return dict([(col, func(a[col], b[col])) for col in a.columns]) File "C:\Python27\lib\site-packages\pandas\core\ops.py", line 813, in wrapper return self._constructor(na_op(self.values, other.values), File "C:\Python27\lib\site-packages\pandas\core\ops.py", line 768, in na_op raise TypeError("invalid type comparison") TypeError: invalid type comparison 

Code:

 File1 = name10 File2 = name20 Result_file= name30 + Result_file_name_ex print Result_file writer = pd.ExcelWriter(Result_file,engine='openpyxl') Excel1 = pd.ExcelFile(File1) Excel2 = pd.ExcelFile(File2) Sheetvalue = Excel1.sheet_names len_sheetvalue = len(Excel1.sheet_names) Q_increment = 1 for sheet in Sheetvalue: mpb = ttk.Progressbar(top, orient="horizontal", length=400, mode="determinate", maximum=100) mpb["value"] = (Q_increment / len_sheetvalue) * 100 top.update_idletasks() print sheet df0 = Excel1.parse(sheet) df1 = Excel2.parse(sheet) a0, a1 = df0.align(df1) print sheet different = (a0 != a1) comp = a0[different].join(a1[different], lsuffix='_old', rsuffix='_new') comp.to_excel(writer,sheet_name=sheet) workbook = writer.book ws = writer.sheets[sheet] writer.save() L700 = Label(top, text="COMPARISON PROGRESS", font=helv36_ex, bg='white') L700.grid(row=23, pady=25) mpb.grid(row=23, column=1, pady=25) Q_increment = Q_increment + 1 writer.save() tkMessageBox.showinfo("Process Completed","Comparison Output file created successfully")