# Sample Solution
dataset_one = [50, 10, 4, -3, 4, -20, 2]
#Sorted dataset_one: [-20, -3, 2, 4, 4, 10, 50]
dataset_two = [24, 20, 1, 45, -15, 40]
#Sorted dataset_two: [-15, 1, 20, 24, 40, 45]
dataset_one_q2 = 4
dataset_two_q2 = 22
#Define the first and third quartile of both datasets here:
dataset_one_q1 = -3
dataset_one_q3 = 10
dataset_two_q1 = 1
dataset_two_q3 = 40
#Ignore the code below here:
try:
print("The first quartile of dataset one is " + str(dataset_one_q1))
except NameError:
print("You haven't defined dataset_one_q1")
try:
print("The second quartile of dataset one is " + str(dataset_one_q2))
except NameError:
print("You haven't defined dataset_one_q2")
try:
print("The third quartile of dataset one is " + str(dataset_one_q3) + "\n")
except NameError:
print("You haven't defined dataset_one_q3\n")
try:
print("The first quartile of dataset two is " + str(dataset_two_q1))
except NameError:
print("You haven't defined dataset_two_q1")
try:
print("The second quartile of dataset two is " + str(dataset_two_q2))
except NameError:
print("You haven't defined dataset_two_q2")
try:
print("The third quartile of dataset two is " + str(dataset_two_q3))
except NameError:
print("You haven't defined dataset_two_q3")
Quotes help make search much faster. Example: "Practice Makes Perfect"
Saturday, August 31, 2019
Codecademy Learn Statistics With Python Quartiles Exercise 2/6
# Sample Solution
dataset_one = [50, 10, 4, -3, 4, -20, 2]
#Sorted dataset_one: [-20, -3, 2, 4, 4, 10, 50]
dataset_two = [24, 20, 1, 45, -15, 40]
#Sorted dataset_two: [-15, 1, 20, 24, 40, 45]
#Define the second quartile of both datasets here:
dataset_one_q2 = 4
dataset_two_q2 = 22
#Ignore the code below here:
try:
print("The second quartile of dataset one is " + str(dataset_one_q2))
except NameError:
print("You haven't defined dataset_one_q2")
try:
print("The second quartile of dataset two is " + str(dataset_two_q2))
except NameError:
print("You haven't defined dataset_two_q2")
dataset_one = [50, 10, 4, -3, 4, -20, 2]
#Sorted dataset_one: [-20, -3, 2, 4, 4, 10, 50]
dataset_two = [24, 20, 1, 45, -15, 40]
#Sorted dataset_two: [-15, 1, 20, 24, 40, 45]
#Define the second quartile of both datasets here:
dataset_one_q2 = 4
dataset_two_q2 = 22
#Ignore the code below here:
try:
print("The second quartile of dataset one is " + str(dataset_one_q2))
except NameError:
print("You haven't defined dataset_one_q2")
try:
print("The second quartile of dataset two is " + str(dataset_two_q2))
except NameError:
print("You haven't defined dataset_two_q2")
Codecademy Learn Statistics With Python Histograms Exercise 9/9
# Sample Solution
# Import packages
import codecademylib
import numpy as np
import pandas as pd
# Import matplotlib pyplot
from matplotlib import pyplot as plt
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
cost = transactions["Cost"].values
# Use plt.hist() below
plt.hist(cost, range = (0, 165), bins = 165, edgecolor = 'black')
plt.title("Cost Frequency")
plt.xlabel("Cost (1 dollar increments)")
plt.ylabel("Count")
plt.show()
# Import packages
import codecademylib
import numpy as np
import pandas as pd
# Import matplotlib pyplot
from matplotlib import pyplot as plt
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
cost = transactions["Cost"].values
# Use plt.hist() below
plt.hist(cost, range = (0, 165), bins = 165, edgecolor = 'black')
plt.title("Cost Frequency")
plt.xlabel("Cost (1 dollar increments)")
plt.ylabel("Count")
plt.show()
Codecademy Learn Statistics With Python Histograms Exercise 8/9
# Sample Solution
# Import packages
import codecademylib
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
# Use plt.hist() below
plt.hist(times, range=(0, 24), bins=24, edgecolor="black")
plt.title("Weekday Frequency of Customers")
plt.xlabel("Hours (1 hour increments)")
plt.ylabel("Count")
plt.show()
# Import packages
import codecademylib
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
# Use plt.hist() below
plt.hist(times, range=(0, 24), bins=24, edgecolor="black")
plt.title("Weekday Frequency of Customers")
plt.xlabel("Hours (1 hour increments)")
plt.ylabel("Count")
plt.show()
Codecademy Learn Statistics With Python Histograms Exercise 7/9
# Sample Solution
# Import packages
import codecademylib
import numpy as np
import pandas as pd
# import pyplot as plt
from matplotlib import pyplot as plt
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
# Use plt.hist() below
plt.hist(times, range = (0, 24), bins = 4, edgecolor = 'black')
plt.title("Transaction Time Histogram")
plt.xlabel("Time Ranges")
plt.ylabel("Count")
plt.show()
# Import packages
import codecademylib
import numpy as np
import pandas as pd
# import pyplot as plt
from matplotlib import pyplot as plt
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
# Use plt.hist() below
plt.hist(times, range = (0, 24), bins = 4, edgecolor = 'black')
plt.title("Transaction Time Histogram")
plt.xlabel("Time Ranges")
plt.ylabel("Count")
plt.show()
Codecademy Learn Statistics With Python Histograms Exercise 6/9
# Sample Solution
# Import packages
import numpy as np
import pandas as pd
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
# Use numpy.histogram() below
times_hist = np.histogram(times, range = (0, 24), bins = 4)
print(times_hist)
# Import packages
import numpy as np
import pandas as pd
# Read in transactions data
transactions = pd.read_csv("transactions.csv")
# Save transaction times to a separate numpy array
times = transactions["Transaction Time"].values
# Use numpy.histogram() below
times_hist = np.histogram(times, range = (0, 24), bins = 4)
print(times_hist)
Codecademy Learn Statistics With Python Histograms Exercise 5/9
# Sample Solution
# Import packages
import numpy as np
import pandas as pd
# Array of days old bread
days_old_bread = np.array([0, 8, 7, 8, 0, 2, 3, 5, 6, 2])
# Count the values in each bin
days_old_012 = 4
days_old_345 = 2
days_old_678 = 4
# Printing the values
print("Between 0 and 2 days: " + str(days_old_012))
print("Between 3 and 5 days: " + str(days_old_345))
print("Between 6 and 8 days: " + str(days_old_678))
# Import packages
import numpy as np
import pandas as pd
# Array of days old bread
days_old_bread = np.array([0, 8, 7, 8, 0, 2, 3, 5, 6, 2])
# Count the values in each bin
days_old_012 = 4
days_old_345 = 2
days_old_678 = 4
# Printing the values
print("Between 0 and 2 days: " + str(days_old_012))
print("Between 3 and 5 days: " + str(days_old_345))
print("Between 6 and 8 days: " + str(days_old_678))
Subscribe to:
Posts (Atom)
This is an example of scrolling text using Javascript.
Popular Posts
-
<html> <head> <!-- Add the Parse SDK here! --> <script src="http://www.parsecdn.com/js/par...
-
$("#tours > li")
-
Answer: Alt - p p stands for previous. If you keep pressing Alt - p, you will continue cycling back through commands you typed before. I...
-
<!-- Sample solution to index.html --> <!DOCTYPE html> <html> <body> <div class="nav"> ...
-
//sample solution def isEven(x): if(x % 2 == 0): return "yep" else: return "nope"
-
<!--sample solution--> <html> <head> <title>Week 13 Project</title> </head> ...
-
#sample solution hungry = false unless hungry puts "I'm writing Ruby programs!" else puts "Time to eat!...
-
//sample solution var yourName = "Pam"; var gender = "female"; var result; //Line 10 starts an if statement //Ne...
-
function isCorrectColumn(sudoku, col) { // This method should return true if all the numbers from 1 to 9 // are present in the co...
-
#sample solution Webster = { "Aardvark" : "A star of a popular children's cartoon show.", "Baa...