df1 = pd.read_excel(mxln) # Loads master xlsx for comparison
df2 = pd.read_excel(sfcn) # Loads student xlsx for comparison
difference = df2[df2 != df1] # Scans for differences
无论哪里有区别,我都希望将这些单元格位置存储在一个列表中。它的格式必须是'A1'(而不是[1,1]),这样我就可以通过以下方式传递它:
^{pr2}$我研究过类似this的解决方案,但我无法使其发挥作用/不理解它。例如,以下命令不起作用:
def highlight_cells():
df1 = pd.read_excel(mxln) # Loads master xlsx for comparison
df2 = pd.read_excel(sfcn) # Loads student xlsx for comparison
difference = df2[df2 != df1] # Scans for differences
return ['background-color: yellow']
df2.style.apply(highlight_cells)
要将两个^{} 的差异单元格作为excel坐标,可以执行以下操作:
代码:
测试代码:
^{pr2}$结果:
相关问题 更多 >
编程相关推荐