I have a dataframe.
(我有一个数据框。)
I am trying to find percentiles of datetimes. (我试图找到日期时间的百分位数。)
I am using the function: (我正在使用该功能:)
Dataframe:
(数据框:)
student, attempts, time
student 1,14, 9/3/2019 12:32:32 AM
student 2,2, 9/3/2019 9:37:14 PM
student 3, 5
student 4, 16, 9/5/2019 8:58:14 PM
studentInfo2 = [14, 4, Timestamp('2019-09-04 00:26:36')]
data['time'] = pd.to_datetime(data['time_0001'], errors='coerce')
perc1_first = stats.percentileofscore(data['time'].notnull(), student2Info[2], 'rank')
where student2Info[2] holds the datetime for a particular student.
(其中student2Info [2]保存特定学生的日期时间。)
When I try and do this I get the error: (当我尝试执行此操作时,出现错误:)
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Any ideas on how I can get the percentile to calculate correctly even when there are missing times in the columns?
(关于即使在列中缺少时间的情况下如何获得百分位以正确计算的任何想法?)
ask by newwebdev22 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…