我想使用apply方法遍历各行。第一行"1“是一个带句子的字符串,其余的行是浮点数。我将把这几行用到一个函数中。my_function(row1, row2, row3, row4): '''do some stuff here with the rows'''
return # the dataframewith the modification to the float rows "2"
在我的代码中,我使用df.style.applymap()将HTML呈现到我的intranet网页上。我有下面的代码,它很适合我,(2列被传递到我的函数highlight_vals)。-0.9: else:现在,我希望使用类似的函数(或者曾经使用当前的highlight_vals)来实现比较高亮,条件是:
if ValinColumn1
我希望找到一种使用applymap的方法来做这件事,但是找不到一种方法来返回传递给applymap的值的索引,这是可能的吗?我已经能够使用itertuples使其工作,但我希望使用applymap对其进行重构并使其更高效。# Mock data creationresults= pd.DataFrame</em