Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use Jupyter notebook to solve this code: Source: # Load the data and libraries import pandas as pd import numpy as np from

Use Jupyter notebook to solve this code:
Source:

  

# Load the data and libraries
import pandas as pd
import numpy as np
from scipy import stats
import matplotlib.pyplot as plt
plt.style.use('seaborn-whitegrid')
from unittest.mock import patch

def laplace_mech(v, sensitivity, epsilon):
   return v + np.random.laplace(loc=0, scale=sensitivity / epsilon)

adult = pd.read_csv('https://github.com/jnear/cs211-data-privacy/raw/master/homework/adult_with_pii.csv')
adult = adult.dropna()

Question:

Write code to answer the query: "how many participants have never been married?"

Hint: filter the adult_data data frame to contain only participants who were never married, then return the len of the filtered data frame.

def query1():
   # YOUR CODE HERE
   raise NotImplementedError()

query1()


# TEST CASE for question 1
assert query1() == 9726

Type Markdown and LaTeX: ????2

In [1]: # Load the data and Libraries import pandas as pd import numpy as np from scipy import stats import matplotlib.pyplot as plt plt.style.use('seaborn-whitegrid') from unittest.mock import patch def laplace_mech(v, sensitivity, epsilon): return v + np.random.laplace(loc=0, scale-sensitivity / epsilon) pd.read_csv('https://github.com/jnear/cs211-data-privacy/raw/master/homework/adult_with_pii.csv') adult = adult - adult.dropna ()

Step by Step Solution

3.52 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

Certainly Heres a Jupyter Notebook code to answer the query how many participants have never been ma... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

International Economics

Authors: Robert C. Feenstra, Alan M. Taylor

5th Edition

1319218504, 9781319218508

More Books

Students also viewed these Programming questions

Question

2. Do not crowd the student. Do not get in the students face.

Answered: 1 week ago

Question

What are the principal alloying elements in SAE 4340 steel?

Answered: 1 week ago

Question

9. How do epinephrine and cortisol enhance memory storage?

Answered: 1 week ago

Question

5. Which types of memory are least impaired in H. M.?

Answered: 1 week ago