2017-03-17 12 views
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 

파이썬에 대해 이동?

+0

질문을 명확하게 할 수 있습니까? 하루에 s.d를 계산 하시겠습니까? – Himaprasoon

답변

0

각 고객에 대한 일일 근무 시간은 얼마입니까?

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) 
+0

안녕하세요, 도움 주셔서 감사하지만 오전 9시 30 분에 예상되는 표준 편차를 계산하고 싶습니다. 여기서 평균은 오전 9시 30 분에 고정되어 직원의 표준 편차에 대한 K 평균을 구합니다. – gopalm