Question: 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:

In [1]: # Load the data and Libraries import pandas as pd

 import numpy as np from scipy import stats import matplotlib.pyplot as plt 

# 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

1 Expert Approved Answer
Step: 1 Unlock

Certainly Heres a Jupyter Notebook code to answer the query how many participants have never been ma... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!