0
我想计算员工明智的每日时间的标准偏差。员工每日出勤时间的明智标准差
以下是该数据帧或CSV我输入:
EmpCode,Date,InTime,OutTime,expetcedIn,expetcedOut
9889,01-Feb-17,9:34 AM,5:41:00 PM,9:30:00 AM,5:30:00 PM
如何去了解它在Python?
我想计算员工明智的每日时间的标准偏差。员工每日出勤时间的明智标准差
以下是该数据帧或CSV我输入:
EmpCode,Date,InTime,OutTime,expetcedIn,expetcedOut
9889,01-Feb-17,9:34 AM,5:41:00 PM,9:30:00 AM,5:30:00 PM
如何去了解它在Python?
我希望你想要的是每个客户每天的工作时间得到s.d。
import pandas as pd
# Read csv and parses col[1,2] as InTimeWithDate and col[1,3] as OutTimeWithDate
df=pd.read_csv("emp.csv", parse_dates={"InTimeWithDate":[1,2],"OutTimeWithDate":[1,3]})
# Gets difference between In and out time in minutes : to get in seconds changed timedelta64[m] to timedelta64[s]
df["minutes_worked"]= (df["OutTimeWithDate"]-df["InTimeWithDate"]).astype('timedelta64[m]')
# Groups by employee and gets standard diff of minutes worked
new_df = df.groupby("EmpCode").agg({"minutes_worked":["std"]})
print(new_df)
嗨,感谢您的帮助,但我想计算标准偏差的预计时间为上午9:30。这里的平均值是上午9:30确定的,然后想要绘制员工标准偏差的K均值 – gopalm
您能否让您的问题更清楚? 你想每天计算s.d吗? – Himaprasoon