Lab04_WriteUp

Question 1 dataset Question 1a Above, it seems like OFFENSE is more specific than CVLEGEND, e.g. “LARCENY” vs. “THEFT FELONY (OVER $950)”. If you’re unfamiliar with the term, “larceny” is a legal term for theft of personal property. To get a sense of how many subcategories there are for each OFFENSE, set calls_by_cvlegend_and_offense equal to a multi-indexed series where the data is first indexed on the CVLEGEND and then on the OFFENSE, and the data is equal to the number of offenses in the database that match the respective CVLEGEND and OFFENSE.

Lab03_WriteUp

Question 1 Question 1a For a DataFrame d, you can add a column with d['new column name'] = ... and assign a list or array of values to the column. Add a column of integers containing 1, 2, 3, and 4 called rank1 to the fruit_info table which expresses your personal preference about the taste ordering for each fruit (1 is tastiest; 4 is least tasty). Question 1b You can also add a column to d with d.

Count Complete Tree Nodes

222.Count Complete Tree Nodes Description Given the root of a complete binary tree, return the number of the nodes in the tree. According to Wikipedia, every level, except possibly the last, is completely filled in a complete binary tree, and all nodes in the last level are as far left as possible. It can have between 1 and $2^h$ nodes inclusive at the last level h. Design an algorithm that

Lab02_WriteUp

dataset Question 1 For this question we will use SQL to extract data out of the indiv_sample_nyc table. The schema for this table is given below. Question 1a Let’s start by looking at 2016 election contributions made by Donald Trump, who was a NY resident during that year. Write a SQL statement that will return the cmte_id, transaction_amt, and name for every contribution made by any donor with “DONALD” and “TRUMP” in their name.

Lab01_WriteUp

Question 1 Question 1a Write a function summation that evaluates the following summation for $n \geq 1$: $$\sum_{i=1}^{n} i^3 + 3 i^2$$ 1 2 3 4 def summation(n): """Compute the summation i^3 + 3 * i^2 for 1 <= i <= n.""" ... return sum(i**3+3*i**2 for i in range(1,n+1)) Question 1b Write a function elementwise_list_sum that computes the square of each value in list_1, the cube of each value in list_2, then returns a list containing the element-wise sum of these results.