Search Header Logo

modul 2

Authored by Fathin Difa

Computers

Professional Development

Used 14+ times

modul 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

20 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Choose the correct answer.

np.random.rand(5,3)

np.random.rand(15).reshape(3,5)

np.random.randint(0,100,((3,5))

np.random.randn(15,((3,5))

np.random.randn(15).reshape(5,3)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which code has the expected sub-array?

arr[1:][2:]

arr[2:,1:]

arr[2:][1:]

arr[1:,2:]

arr[1,2:]

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In Pandas, which methods can be used to combine 2 dataframes?

coalition

All options are correct

concat

extend

append

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A dataframe, named df, contains employees data, their positions and their salaries. Here are the first 5 rows of df.

Which is the correct way to find the number of unique job titles (JobTitle) registered in df?

df[‘JobTitle’].nunique()

df[‘JobTitle’].unique()

df.groupby(‘JobTitle’)

df.sort_values(‘JobTitle’,ascending=False)

df[‘JobTitle’].count()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

A dataframe, named df, contains employees data, their positions and their salaries. Here are the first 5 rows of df.

Which is the correct way to find the average base pay (BasePay) of employees in 2012?

df['BasePay'][df['Year']==2012].mean()

df.loc[2012]['BasePay'].mean()

df.iloc[df['Year']==2012]['BasePay'].mean()

All options are correct

df.iloc[df['Year']==2012]['BasePay'].avg()

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

Which is the correct description for the output of the following code. df.groupby('JobTitle').mean().sort_values('TotalPay',ascending=False)['TotalPay'].iloc[:5]

5 job titles (JobTitle) that have the lowest total pay (TotalPay)

Average total pay (TotalPay) by job title (JobTitle)

5 job titles (JobTitle) that have the highest total pay (TotalPay).

5 job titles (JobTitle) and their average total pay (TotalPay) which has the highest total pay (TotalPay)

5 Position (JobTitle) and average total pay (TotalPay) which has the lowest total pay (TotalPay)

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

You are interested to see if base pay (BasePay) has any relation to overtime pay (OvertimePay). Here are the results of your data normality test.

Which is the most appropriate way to test the correlation between BasePay and OvertimePay?

df['BasePay'].corr(df['OvertimePay'], method=’pearson’)

df[['BasePay','OvertimePay']].corr()

df[['BasePay','OvertimePay']].corr(‘spearman’)

df.corr()[['BasePay','OvertimePay']]

df['BasePay'].corr(df['OvertimePay'])

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?