我想对DataFrame中所有index结尾为“_count”的行的数据取整数,下面是我的DataFrame
我测试过了2段代码,但是好像都没有用
for index, row in a.iterrows():
if row.index.values[0].endswith('_count'):
"{:.0f}".format(row['units'])
for index, row in a.iterrows():
if row.index.values[0].endswith('_count'):
row['units'].apply(lambda x : format(x, '.0f') if pd.notnull(x) else '')
请问有什么办法能达到我想要的效果