from datascience import *
import numpy as np
%matplotlib inline
import matplotlib.pyplot as plots
plots.style.use('fivethirtyeight')
np.arange(5)
np.arange(7, 25)
np.arange(5, 25, 10)
np.arange(5, 26, 10)
np.arange(5, 25.01, 10)
Table()
streets = make_array('Bancroft', 'Durant', 'Channing', 'Haste')
streets
Table().with_column('Street name', streets)
southside = Table().with_column('Street name', streets)
# creates a new table with the specified column
southside.with_column('Blocks away from campus', np.arange(4))
southside
southside = southside.with_column('Blocks away from campus', np.arange(4))
southside
minard = Table.read_table('minard.csv')
minard
minard.select('Survivors')
minard.column('Survivors')
minard.column('Survivors').item(0)
initial_count = minard.column('Survivors').item(0)
initial_count
proportion_surviving = minard.column('Survivors')/initial_count
proportion_surviving
minard = minard.with_column('Percent surviving', proportion_surviving)
minard
minard.set_format('Percent surviving', PercentFormatter)
movies = Table.read_table('movies_by_year_with_ticket_price.csv')
movies.show()
movies.labels
movies.num_rows
number_of_tix = movies.column('Total Gross') * (10 ** 6) / movies.column('Average Ticket Price')
movies = movies.with_column('Number of tickets', number_of_tix)
movies
movies.set_format(5, NumberFormatter)
movies.plot('Year', 'Number of tickets')
movies.where('Year', are.between(2000, 2005))
movies.where('#1 Movie', are.equal_to('Avatar'))
movies.where('#1 Movie', 'Avatar')
movies.where('#1 Movie', are.containing('Harry Potter'))
movies.where('Number of Movies', are.below(450))
movies.where('Year', are.above(2010))
movies.take(3)
movies.take(np.arange(4))