Knowee
Questions
Features
Study Tools

What will the following code do?def new_income(income):      return income **2 + 100data = df['income'].apply(new_income)data.sum()A.Square the income column and add 100.B.Double the income column and add 100.C.Square the income column, add 100, and then sum up all incomes.D.Double the income column, add 100, and then sum up all salaries.

Question

What will the following code do?def new_income(income):      return income **2 + 100data = df['income'].apply(new_income)data.sum()A.Square the income column and add 100.B.Double the income column and add 100.C.Square the income column, add 100, and then sum up all incomes.D.Double the income column, add 100, and then sum up all salaries.

🧐 Not the exact question you are looking for?Go ask a question

Solution

The code will square the income column, add 100, and then sum up all incomes. So, the correct answer is C. Square the income column, add 100, and then sum up all incomes.

Similar Questions

What will the following code generate?df = df[ (df['income'] <= 2000) ]df['income'].sum()A.Select employees who make less than $2,000.B.Select employees who make less than or equal to $2,000, and then sum up all their salaries.C.Select employees who make more than $2,000.D.Select employees who make more than or equal to $2,000, and then sum up all their salaries.

What will the following code generate?portfolio_df = pd.DataFrame({'stock ticker symbols' : ['FB', 'TSLA', 'T'],'price per share [$]' : [20, 30, 40],'Number of stocks' : [1, 1, 1]})stocks_dollar_value = portfolio_df['price per share [$]'] * portfolio_df['Number of stocks']print('Total portfolio value = {}'.format(stocks_dollar_value.sum()))A.Total portfolio value = 90B.Total portfolio value = 100C.Total portfolio value = 2,400D.Total portfolio value = 600

What is the output of the following code snippet?class Node:    def __init__(self, value):        self.data = value        self.left = None        self.right = Nonedef calculate_sum(node):    if node is None:        return 0    return node.data + calculate_sum(node.left) + calculate_sum(node.right) # Usage example:root = Node(1)root.left = Node(2)root.right = Node(3)root.left.left = Node(4)root.left.right = Node(5)print(calculate_sum(root))Options115106

What is the output of the following code snippet?class Node:    def __init__(self, value):        self.data = value        self.left = None        self.right = Nonedef calculate_sum(node):    if node is None:        return 0    return node.data + calculate_sum(node.left) + calculate_sum(node.right) # Usage example:root = Node(1)root.left = Node(2)root.right = Node(3)root.left.left = Node(4)root.left.right = Node(5)print(calculate_sum(root))Options615110

Write a program to calculate the income tax as follows Use the below data to calculate the Income_Tax if(Tax_Income <= 0) # Output : hurray..no income tax Otherwise calculate the Income_Tax as follows if (Gross_Income <= 500000): Income_Tax = (Tax_Income * .1) if (Gross_Income <= 1000000) and (Gross_Income > 500000): Income_Tax = 25000 + ((Gross_Income - 500000)*.2) if (Gross_Income > 1000000): Income_Tax = 75000 + ((Gross_Income - 1000000) *.3) Fill the missing code in the given program to the find income tax. Ded_std, Ded_tot and Tax_Income are already defined the code Sample Input and Output 1: deduction under 80c: 50000 deduction under 80cc: 5000 deduction under HRA: 15000 deduction under Medical: 10000 gross income: 250000 gross income: 250000 total deductions: 230000 income tax: 2000.0 Sample Input and Output 2: deduction under 80c: 5000 deduction under 80cc: 2000 deduction under HRA: 1500 deduction under Medical: 500 gross income: 20000 hurray..no income tax give the programming in python

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.