import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd
import numpy as np
import scipy.stats as stats
CS 361 students answered the survey below.
Q1: What's your name? (student names removed for privacy)
Q2: We will roll a 6-sided die. Guess how many rolls will it take to see the first 6.
Q3: If the prize were $100, what's the most you would bet (in dollars) to play this game?
Q4: Have you ever been to Las Vegas?
df = pd.read_csv("121278.csv")
df
winning_number = 1
df[df["Q2:Rolls"]==winning_number]
vegas_counts = df["Q4:Vegas"].value_counts()
vegas_counts
plt.bar(vegas_counts.keys(), vegas_counts)
plt.title("Have you ever been to Las Vegas?")
plt.ylabel("Count")
df = df[df["Q3:Bet"]<=100] #remove outlier (someone wanted to bet too big!)
plt.subplot(1, 2, 1)
plt.hist(df["Q3:Bet"], bins=100)
plt.xlabel("Bet")
plt.ylabel("Count")
plt.title("Histogram of bets with 100 bins")
plt.subplot(1, 2, 2)
plt.hist(df["Q3:Bet"], bins=10)
plt.xlabel("Bet")
plt.ylabel("Count")
plt.title("Histogram of bets with 10 bins")
plt.subplots_adjust(bottom=0, top=1, left=-0.5, right=1.5)
plt.subplot(1, 2, 1)
plt.hist(df[df["Q4:Vegas"]=="Yes"]["Q3:Bet"], bins=np.arange(0, 101, 10), color="r", ec="k")
plt.xlabel("Bet")
plt.ylabel("Count")
plt.title("Histogram of bets for those who have been to Las Vegas")
plt.subplot(1, 2, 2)
plt.hist(df[df["Q4:Vegas"]=="No"]["Q3:Bet"], bins=np.arange(0, 101, 10), color="b", ec="k")
plt.xlabel("Bet")
plt.ylabel("Count")
plt.title("Histogram of bets for those who haven't been to Las Vegas")
plt.subplots_adjust(bottom=0, top=1, left=-0.5, right=1.5)