find the department that has the most efficient team (the team with the minimum percentage of employees who need training)

Viewed 23

import numpy as np import pandas as pd

The file is stored at the following path:

'https://media-doselect.s3.amazonaws.com/generic/NMgEjwkAEGGQZBoNYGr9Ld7w0/rating.csv'

df = pd.read_csv('https://media-doselect.s3.amazonaws.com/generic/NMgEjwkAEGGQZBoNYGr9Ld7w0/rating.csv') df['Training'] = df.Rating.apply(lambda x : 'No' if x <= 3.5 else 'Yes') df.head()

1 Answers

If I'm understanding correctly?

import pandas as pd


df = pd.read_csv('https://media-doselect.s3.amazonaws.com/generic/NMgEjwkAEGGQZBoNYGr9Ld7w0/rating.csv')

df = (
    df
    .groupby("Department")["Rating"]
    .mean()
    .reset_index()
    .min()["Department"]
)

print(df)

Finance
Related