Quotes help make search much faster. Example: "Practice Makes Perfect"

Saturday, August 31, 2019

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()

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts