code: import numpy as np
  import pandas as pd
  from scipy.stats import chi2_contingency
  
  # preset values
  significance_threshold = 0.05
  sample_size = 100
  lift = .3
  control_rate = .5
  name_rate = (1 + lift) * control_rate
  
  # initialize an empty list of results
  results = []
  
  # start the loop
  for i in range(100):
    # simulate data:
    sample_control = np.random.choice(['yes', 'no'],  size=int(sample_size/2), p=[control_rate, 1-control_rate])
    sample_name = np.random.choice(['yes', 'no'], size=int(sample_size/2), p=[name_rate, 1-name_rate])
    group = ['control']*int(sample_size/2) + ['name']*int(sample_size/2)
    outcome = list(sample_control) + list(sample_name)
    sim_data = {"Email": group, "Opened": outcome}
    sim_data = pd.DataFrame(sim_data)
  
    # run the test
    ab_contingency = pd.crosstab(np.array(sim_data.Email), np.array(sim_data.Opened))
    chi2, pval, dof, expected = chi2_contingency(ab_contingency)
    result = ('significant' if pval < significance_threshold else 'not significant')
  
    # append the result to our results list here:
    results.append(result)
  
  # calculate proportion of significant results here:
  print("Proportion of significant results:")
  results = np.array(results)
  print(np.sum(results == 'significant')/100)
   import codecademylib3
  
  # Import pandas with alias
  import pandas as pd
  
  # Import dataset as a Pandas Dataframe
  movies = pd.read_csv("movie_show.csv", index_col=0)
  
  # Print the first five rows of the dataframe
  print(movies.head())
  
  # Print the data types of the dataframe
  print(movies.dtypes)
  
  # Replace any missing values in release_year with 2019
  movies['release_year'] = movies['release_year'].replace(['missing'], 2019)
  
  # Change the data type of release_year to int
  movies['release_year'] = pd.to_numeric(movies['release_year'])
  
  # Recheck the data types with .dtypes.
  print(movies.dtypes)
  
  # Calculate the mean of release_year
  print(movies['release_year'].mean())
apis: numpy.array numpy.sum pandas.DataFrame scipy.stats.chi2_contingency
apis: pandas.read_csv pandas.to_numeric