In [2]:
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import seaborn as sns
%matplotlib inline
In [3]:
#df = pd.read_csv('/home/tribilium/Downloads/grades.csv', header=None, names=['grades'])
df = pd.read_csv('grades.csv', header=None, names=['grades'])
In [5]:
df.head()
Out[5]:
In [6]:
df.describe()
Out[6]:
In [7]:
df.columns[0]
grade_mat = df.as_matrix()
In [9]:
grade_mat
Out[9]:
In [10]:
grade_mat.shape
Out[10]:
In [14]:
plt.style.use('fivethirtyeight')
fig, ax = plt.subplots()
plt.hist(grade_mat, bins=[50, 60, 70, 80, 90, 100])
ax.set_xlim([50, 100])
ax.set_xlabel('Grade Range')
ax.set_ylabel('Number of Students')
ax.set_title('Histogram of Exam 1 Grades - ENGR262 Winter 2018')
Out[14]:
In [15]:
plt.style.use('fivethirtyeight')
fig, ax = plt.subplots()
plt.hist(df['grades'], bins=[50, 60, 70, 80, 90, 100])
ax.set_xlim([50, 100])
ax.set_xlabel('Grade Range')
ax.set_ylabel('Number of Students')
ax.set_title('Histogram of Exam 1 Grades - ENGR262 Winter 2018')
Out[15]:
In [16]:
min_grade = min(df['grades'])
In [17]:
min_grade
Out[17]:
In [18]:
min_grade=min_grade*.1
In [19]:
min_grade
Out[19]:
In [23]:
min_grade_floor = np.floor(min_grade)
In [25]:
min_grade = min_grade_floor*10
min_grade = int(min_grade)
In [26]:
bin_array = np.arange(min_grade,110,10)
bin_array
Out[26]:
In [29]:
bin_array.tolist()
Out[29]:
In [30]:
plt.style.use('fivethirtyeight')
fig, ax = plt.subplots()
plt.hist(df['grades'], bins=bin_array)
ax.set_xlim([min_grade, 100])
ax.set_xlabel('Grade Range')
ax.set_ylabel('Number of Students')
ax.set_title('Histogram of Exam 1 Grades - ENGR262 Winter 2018')
Out[30]:
In [ ]: