# -*- coding: utf-8 -*-
"""
Created on Tue May 21 21:51:10 2019
@author: User
"""
import numpy as np
def liftscore(n):
n_new = np.sqrt((n^2) * 100)
return n_new
score = np.array([87,77,56,100,60])
score_1 = np.frompyfunc(liftscore, 1, 1)(score)
print(score_1)
score_1 = score_1.astype(float)
print(score_1.dtype)
运行:
[92.19544457292888 88.88194417315589 76.15773105863909 100.99504938362078
78.74007874011811]
float64