我想让这个custum函数为panda数据帧工作
它是一个具有两个输入的简单函数
计算熊猫数据框中文本的阅读时间
c=图像计数 x=字数
(5.717938+(12.03401-5.717938)/(1+(c/3.579499)^4.092419))*c)+x*0.0037736111113
我试过几种方法,但都没能使它正常工作
def readingT(df, y="imageCount", x="wordCount"):
readingTimeImage = (5.717938 + (12.03401 - 5.717938)/(1 + (c/3.579499)^4.092419))* c
readingTimeWords = 0.0037736111111111113 * x
return readingTimeImage + readingTimeWords
def readingT2(c="imageCount", w="wordCount"):
return ((5.717938 + (12.03401 - 5.717938)/(1 + (c/3.579499)^4.092419))* c + 0.0037736111111111113 * w)
readingT2.apply(readingT, c="imageCount", w="wordCount")
#Try next
def readingT3(x, y):
(((5.717938 + (12.03401 - 5.717938)/(1 + ( x /3.579499)**4.092419)) * x) + 0.0037736111111111113 * y)
readingT3.apply(lambda x: rule(x["imageCount"], x["wordCount"]), axis = 1)
他们每个人都会犯错误
为任何帮助提前干杯
相关问题 更多 >
编程相关推荐