尝试使用2个数据点计算数据的音高信息
使用的功能
def pitch_calculate(x,y,z):
x_Buff = float(x)
y_Buff = float(y)
z_Buff = float(z)
pitch = np.arctan2((- x_Buff) , np.sqrt(y_Buff * y_Buff + z_Buff * z_Buff)) * 57.3
return pitch
熊猫应用
df['PITCH'] = df.apply(lambda x: pitch_calculate(x['x'], x['y'], x['z'] ), axis=1)
如何为此实现矢量计算?
答案 0 :(得分:1)
df['PITCH'] = np.arctan2(-df.x, np.sqrt(df.y * df.y + df.z * df.z)) * 57.3