在学习Pandas Style时,我了解了以下内容:
def highlight_max(s):
'''
highlight the maximum in a Series yellow.
'''
is_max = s == s.max()
return ['background-color: yellow' if v else '' for v in is_max]
我应该如何阅读
is_max = s == s.max()
? 最佳答案
s == s.max()
将计算为 bool 值(由于变量之间的==
)。下一步是将该值存储在is_max
中。
关于python - is_max = s == s.max()|我应该怎么读?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39997334/