030_编写复杂方程

 

 

import pandas as pd
import numpy as np

def get_circumcircle_area(l, h):
    r = np.sqrt(l**2 + h**2) / 2
    return r**2 * np.pi

def warapper(row):
    result = get_circumcircle_area(row["Length"], row["Height"])
    return result

if __name__ == '__main__':
    rects = pd.read_excel("C:/Users/18124/Desktop/pandas/030_编写复杂方程/Rectangles.xlsx")
    rects["CA"] = rects.apply(warapper, axis=1)

    print(rects)

 

posted @ 2021-02-17 20:24  火焰马  阅读(58)  评论(0编辑  收藏  举报