I would like to plot 8 subplots for each rescued dog race.
rescued_pop = 8
rescued_dog_race = ["rottweiler", "poodle", "pitbull", "chihuahua", "shihtzu", "whippet", "terrier", "greyhound"]
rescued = float(df.loc[df.breed == rescued_dog_race,"rescued"].to_string(index=False))
for j in range(7):
for i in range(1000):
simulated_dog_race = np.random.choice(["yes", "no"], size = 100, p=[rescued[j]/100,1-(rescued[j]/100)])
num_rescued = np.sum(simulated_dog_race == "yes")
null_outcomes.append(num_rescued)
print(i,rescued[j],null_outcomes)
print(i,rescued[j],null_outcomes)
The dataframe looks like that:
Currently I can generate a bar plot for a define "rescued_dog_race".
np.random.seed(1)
rescued_pop = 8
rescued_dog_race = "whippet"
rescued = float(df.loc[df.breed == rescued_dog_race,"rescued"].to_string(index=False))
null_outcomes = []
null_outcomes_pop = []
for i in range(1000):
simulated_dog_race = np.random.choice(["yes", "no"], size = 100, p=[rescued/100,1-(rescued/100)])
num_rescued = np.sum(simulated_dog_race == "yes")
null_outcomes.append(num_rescued)
for i in range(1000):
simulated_pop = np.random.choice(["yes", "no"], size = 100, p=[rescued_pop/100,1-(rescued_pop/100)])
num_rescued_pop = np.sum(simulated_pop == "yes")
null_outcomes_pop.append(num_rescued_pop)
rescued? And what exactly is your question? Are you asking how to get the number ofyesanswers? Are you asking how to plot a barplot of a list containing ints? Could you provide more code of what you tried?for j in range(7):" — oh well, Python does not work like that…