C2 rep

 avatar
user_1718919
plain_text
4 months ago
714 B
4
Indexable
# Calculate actual hours with time adjustments
logging.info("Calculating actual hours...")

# Convert time adjustments to hours
df['TIMEADJUSTEARLY'] = df['TIMEADJUSTEARLY'].fillna(0)
df['TIMEADJUSTLATE'] = df['TIMEADJUSTLATE'].fillna(0)

df['Early_Adjustment'] = df['TIMEADJUSTEARLY'].apply(lambda x: convert_time_to_hours(x) if x != 0 else 0)
df['Late_Adjustment'] = df['TIMEADJUSTLATE'].apply(lambda x: convert_time_to_hours(x) if x != 0 else 0)

# Calculate actual hours
df['Potential Hours'] = pd.to_numeric(df['Potential Hours'], errors='coerce').fillna(0)
df['Actual_Hours'] = df.apply(
    lambda x: max(0, x['Potential Hours'] - (x['Early_Adjustment'] + x['Late_Adjustment'])),
    axis=1
)
Editor is loading...
Leave a Comment