【panda】实现将dataframe中的某列值保留2位⼩数
import pandas as pd
# 读取⽂件内容
ad_excel("daofang.xlsx")
# 计算签单率,保留2位⼩数
df['签单率'] = round((df['签单数量']/df['到访数量'])*100,2)
print(html实现用户注册登录代码
df)
#输出结果
D:\Python\ D:/Python/test/paintPicture/ttt.py
所属地区签单数量到访数量签单率
0 北京 7 11 63.64
1 上海 5 11 45.45
2 深圳 12 22 54.55
3 成都 11 1
4 78.57
4 西安
5 8 62.50