hw04

pdf

School

University of California, Berkeley *

*We aren’t endorsed by this school

Course

20

Subject

Computer Science

Date

Feb 20, 2024

Type

pdf

Pages

10

Uploaded by ColonelAlpaca4085

Report
Question 2. Let’s look at how the Yelp scores compare to the Google scores in the burritos table. First, assign yelp_google_tbl to a table only containing the columns Yelp and Google . Then, make a scatter plot with Yelp scores on the x-axis and the Google scores on the y-axis. (8 Points) In [8]: yelp_google_tbl = burritos . select( 'Yelp' , 'Google' ) yelp_google_tbl . scatter( 'Yelp' , 'Google' ) # Don't change/edit/remove the following line. # To help you make conclusions, we have plotted a straight line on the graph (y=x). plt . plot(np . arange( 2.5 , 5 , .5 ), np . arange( 2.5 , 5 , .5 )); 1
2
Question 3. Looking at the scatter plot you just made in Question 1.2, do you notice any pattern(s) or relationships between Yelp and Google ratings (i.e. is one of the two types of scores consistently higher than the other one)? If so, describe them briefly in the cell below. (8 Points) There seems to be a positive linear association between Google and Yelp ratings. However, ratings on Google tend to be higher than ratings on Yelp. 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
4
Question 6. Edwin thinks that burritos in San Diego are cheaper (and taste better) than the burritos in Berkeley. Plot a histogram that visualizes that distribution of the costs of the burritos from San Diego in the burritos table. Also use the provided cost_bins variable when making your histogram, so that the histogram is more visually informative. (8 Points) In [28]: cost_bins = np . arange( 0 , 15 , 1 ) # Do not change this line # Please also use the provided bins burritos . hist( 'Cost' , bins = cost_bins) 5
6
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Question 2. At the moment, the Job column of the sf table is not sorted (no particular order). Would the arrays you generated in the Jobs column of the previous question be the same if we had sorted alphabetically instead before generating them? Explain your answer. To receive full credit, your answer should reference how the .group method works, and how sorting the Jobs column would affect this. (8 Points) Note: Two arrays are the same if they contain the same number of elements and the elements located at corresponding indexes in the two arrays are identical. An example of arrays that are NOT the same: array([1,2]) != array([2,1]) . Sorting the “Jobs” column before using the .group method would result in different arrays compared to not sorting. The .group method collects values into arrays based on their order in the table, creating a new table with a row for every unique combination of values in grouped columns. If the “Jobs” column is sorted first, it changes the order in which values appear, affecting the arrays produced by .group. This is because .group operates based on the current order in the table, so sorting “Jobs” first alters that order and, consequently, the arrays generated by .group. 7
8
Question 4. Why might some of the row values be 0 in the department_ranges table from the previous question. (8 Points) Type your answer here, replacing this text. 9
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
10