求长方形的外接圆

python学习网 2020-06-15 20:25:04
import  pandas
import numpy
def  get_circle_area(l,h):
    r=numpy.sqrt(l**2+h**2)/2
    return r**2*numpy.pi


excel=pandas.read_excel('长方形.xlsx',index_col='id')
excel['ca']=excel.apply(lambda row:get_circle_area(row['length'],row['width']),axis=1)
print(excel)

 

阅读(2300) 评论(0)