Skip to content

Conversation

@linharesjunior
Copy link

No description provided.

@bripollc
Copy link

Junior,

I leave you some corrections:
Keep going 🚀

  • 3 - Use indexing to return the third value in the Series above.
print(lst[2])

It asks you to return the third value.

  • 11 - Calculate the total quantity ordered and revenue generated from these orders.
print("Total Quantity:", df2["Quantity"].sum())
print("Total Revenue:", df2["Revenue"].sum())

It asks you to calculate the total amount (sum).

  • 12 - Obtain the prices of the most expensive and least expensive items ordered and print the difference.
diff = most_expensive - least_expensive

You need to print the difference. Pequeno lapso:)

  • 3 - In this part of the lab, we would like to test complex conditions on the entire data set at once. Let's start by finding the number of rows where the CGPA is greater than 9 and the student has performed an investigation.
rslt_1 = admissions[(admissions['CGPA'] > 9) & (admissions['Research'] > 0)]
rslt_1

It asks you to find the rows where CGPA > 9 and the student has performed a research Research == 1. You are missing the research condition to filter correctly as requested.

  • 4 - Now return all the rows where the CGPA is greater than 9 and the SOP score is less than 3.5. Find the mean chance of admit for these applicants.
admissions[(admissions["CGPA"] > 9) & (admissions["SOP"] < 3.5)]["Chance of Admit"].mean()

Let's create a new column based on the TOEFL Score column, where we put True if the TOEFL value is greater than 100 and False if it is less. We are going to do it with a function and an apply. To do this, we first create a function that receives an argument. The function will return True if the parameter entered is greater than 100, otherwise it will return False.

def toefl(x):
    if x > 100:
        return True
    else:
        return False

Now we create a new column called "Decision" and apply to the TOEFL Score column

admissions["Decision"] = admissions["TOEFL Score"].apply(toefl)
admissions

Create a column called decision2 in the admissions dataframe. Assign 1 to this column if the value of SOP is greater than 3 and 0 otherwise.
HINT (use np.where)

admissions["decision2"] = np.where(admissions['SOP'] > 3, 1, 0)
admissions

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants