Esempio n. 1
0
# ## 7. Summary and Submission
#
# For your reference, here's a table of all the functions and methods we saw in this lab.
#
# |Name|Example|Purpose|
# |-|-|-|
# |`Table`|`Table()`|Create an empty table, usually to extend with data|
# |`Table.read_table`|`Table.read_table("my_data.csv")`|Create a table from a data file|
# |`with_columns`|`tbl = Table().with_columns("N", np.arange(5), "2*N", np.arange(0, 10, 2))`|Create a copy of a table with more columns|
# |`column`|`tbl.column("N")`|Create an array containing the elements of a column|
# |`sort`|`tbl.sort("N")`|Create a copy of a table sorted by the values in a column|
# |`where`|`tbl.where("N", are.above(2))`|Create a copy of a table with only the rows that match some *predicate*|
# |`num_rows`|`tbl.num_rows`|Compute the number of rows in a table|
# |`num_columns`|`tbl.num_columns`|Compute the number of columns in a table|
# |`select`|`tbl.select("N")`|Create a copy of a table with only some of the columns|
# |`drop`|`tbl.drop("2*N")`|Create a copy of a table without some of the columns|
# |`take`|`tbl.take(np.arange(0, 6, 2))`|Create a copy of the table with only the rows whose indices are in the given array|
#
# <br/>
#
# Congratulations, you're done with lab 3!  Be sure to
# - **run all the tests and verify that they all pass** (the next cell has a shortcut for that),
# - **Save and Checkpoint** from the `File` menu,
# - **run the last cell to submit your work**,

# In[ ]:

# For your convenience, you can run this cell to run all the tests at once!
_ = ok.score()
Esempio n. 2
0
# 
# Now that the table is loaded into the jupyter notebook, you can start analyzing the data.  Let's apply a table method you learned this week.
# 
# **Question 5.2.** <br/>Suppose you wanted to find the highest rated movies in the dataset.  Using the `sort` table method, assign `imdb_sorted` to a table of movies from `imdb` ordered by the highest rated movies.
# 
# *Hint:* If you get stuck, go back and watch the Lec 3.6 video

# In[ ]:


imdb_sorted = ...
imdb_sorted


# In[ ]:


_ = ok.grade('q52')


# # 6. Submission

# Congratulations! You're done with Lab 1!  Be sure to run the tests and verify that they all pass, then choose **Save and Checkpoint** from the **File** menu, then run the final cell (below this one) to submit your work.  If you submit multiple times, your last submission will be counted.

# In[ ]:


# For your convenience, you can run this cell to run all the tests at once!
_ = ok.score(score_out="output.txt")

Esempio n. 3
0
# In[ ]:

_ = ok.grade('q443')

# **Question 4.4.4** <br/>Lastly, let's use array arithmetic to figure the final amount of money in people's market 10 years from now, assuming they all invested different amounts of money (`invested`) in the same stock, DS8. The annual growth rate for DS8 was .045. Assign `money_in_ten_years` to an array of the money people ended with in the DS8 stock based on how much they initially invested.
#
# *Hint*: If you don't remember this formula, check out the textbook!

# In[ ]:

invested = make_array(10, 11, 15, 20, 25)
money_in_ten_years = ...
money_in_ten_years

# In[ ]:

_ = ok.grade('q444')

# # 5. Submission

# Congratulations, you're done with lab 2!  Be sure to
# - **run all the tests** (the next cell has a shortcut for that),
# - **Save and Checkpoint** from the `File` menu,
# - **run the last cell to submit your work**,

# In[ ]:

# For your convenience, you can run this cell to run all the tests at once!
_ = ok.score(score_out='output.txt')