Please do not give solution in image format thanku # Question 2 # Say we want to find the total population of a city. # The city can be divided into an m x n grid of neighborhoods where each neighborhood has a # certain number of buildings. # Conveniently due to zoning laws, all buildings within a neighborhood must have the s # ame number of people. # Inconveniently, in the data a column of buildings per neighborhood is followed by a # column of people per building. For example: toy_city_data = np.array([ [11, 3, 8, 4], [7, 2, 15, 1] ]) # # bldgs # ppl # bldgs # ppl # The toy city above is a 2 x 2 city. # The buildings per neighborhood matrix looks like num_buildings = np.array([ [11, 8], [7, 15] ]) # The people per building looks like num_people_per_building = np.array([ [3, 4], [2, 1] ]) # Then the total population of the city is: # 11*3 + 8*4 + 7*2 + 15*1 # Find the average number of people in each neighborhood of the city from the `city_data` # variable below. city_data = np.array([ [34, 1, 16, 3, 26, 5, 11, 2, 13, 1, 13, 4, 7, 6, 22, 5], [32, 9, 43, 2, 45, 4, 44, 5, 21, 9, 48, 9, 43, 8, 2, 3], [ 7, 5, 44, 3, 17, 5, 24, 9, 2, 4, 11, 3, 2, 7, 41, 2], [38, 1, 26, 8, 25, 1, 11, 9, 9, 2, 41, 3, 8, 9, 44, 9], [23, 8, 9, 6, 1, 1, 28, 7, 2, 7, 12, 4, 21, 6, 19, 7], [13, 3, 31, 6, 2, 8, 28, 5, 17, 3, 37, 3, 41, 6, 19, 4], [26, 8, 40, 6, 16, 7, 9, 4, 30, 2, 44, 8, 12, 8, 40, 7], [11, 6, 39, 9, 30, 8, 23, 2, 40, 9, 16, 2, 49, 5, 47, 8], [ 2, 8, 15, 5, 15, 6, 18, 4, 29, 9, 44, 3, 32, 5, 2, 8], [13, 5, 17, 9, 5, 3, 4, 6, 29, 9, 33, 6, 48, 6, 47, 3], [12, 1, 37, 9, 34, 2, 32, 9, 38, 9, 31, 5, 11, 4, 9, 8], [29, 6, 14, 2, 40, 6, 31, 5, 6, 4, 16, 8, 39, 9, 36, 4], [ 7, 1, 7, 9, 34, 8, 37, 4, 33, 8, 42, 7, 42, 9, 13, 7], [44, 6, 43, 7, 18, 6, 10, 3, 47, 1, 13, 6, 45, 5, 6, 4], [41, 1, 21, 4, 36, 4, 29, 1, 16, 3, 9, 3, 21, 1, 48, 5] ]) even_columns = city_data[:, ::2] odd_columns = city_data[:, 1::2] total_people = np.sum(even_columns * odd_columns) q2 = total_people/((15*16)/2)   # Question 3 # From the city data, calculate the mean and standard error for the number of buildings. # How many people live in neighborhoods that have a number of buildings strictly within 1 standard # error of the mean?   No loops!!

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please do not give solution in image format thanku

# Question 2

# Say we want to find the total population of a city.
# The city can be divided into an m x n grid of neighborhoods where each neighborhood has a
# certain number of buildings.
# Conveniently due to zoning laws, all buildings within a neighborhood must have the s
# ame number of people.

# Inconveniently, in the data a column of buildings per neighborhood is followed by a
# column of people per building. For example:

toy_city_data = np.array([
[11, 3, 8, 4],
[7, 2, 15, 1]
])
# # bldgs # ppl # bldgs # ppl

# The toy city above is a 2 x 2 city.
# The buildings per neighborhood matrix looks like

num_buildings = np.array([
[11, 8],
[7, 15]
])

# The people per building looks like

num_people_per_building = np.array([
[3, 4],
[2, 1]
])

# Then the total population of the city is:
# 11*3 + 8*4 + 7*2 + 15*1
# Find the average number of people in each neighborhood of the city from the `city_data`
# variable below.

city_data = np.array([
[34, 1, 16, 3, 26, 5, 11, 2, 13, 1, 13, 4, 7, 6, 22, 5],
[32, 9, 43, 2, 45, 4, 44, 5, 21, 9, 48, 9, 43, 8, 2, 3],
[ 7, 5, 44, 3, 17, 5, 24, 9, 2, 4, 11, 3, 2, 7, 41, 2],
[38, 1, 26, 8, 25, 1, 11, 9, 9, 2, 41, 3, 8, 9, 44, 9],
[23, 8, 9, 6, 1, 1, 28, 7, 2, 7, 12, 4, 21, 6, 19, 7],
[13, 3, 31, 6, 2, 8, 28, 5, 17, 3, 37, 3, 41, 6, 19, 4],
[26, 8, 40, 6, 16, 7, 9, 4, 30, 2, 44, 8, 12, 8, 40, 7],
[11, 6, 39, 9, 30, 8, 23, 2, 40, 9, 16, 2, 49, 5, 47, 8],
[ 2, 8, 15, 5, 15, 6, 18, 4, 29, 9, 44, 3, 32, 5, 2, 8],
[13, 5, 17, 9, 5, 3, 4, 6, 29, 9, 33, 6, 48, 6, 47, 3],
[12, 1, 37, 9, 34, 2, 32, 9, 38, 9, 31, 5, 11, 4, 9, 8],
[29, 6, 14, 2, 40, 6, 31, 5, 6, 4, 16, 8, 39, 9, 36, 4],
[ 7, 1, 7, 9, 34, 8, 37, 4, 33, 8, 42, 7, 42, 9, 13, 7],
[44, 6, 43, 7, 18, 6, 10, 3, 47, 1, 13, 6, 45, 5, 6, 4],
[41, 1, 21, 4, 36, 4, 29, 1, 16, 3, 9, 3, 21, 1, 48, 5]
])


even_columns = city_data[:, ::2]
odd_columns = city_data[:, 1::2]
total_people = np.sum(even_columns * odd_columns)
q2 = total_people/((15*16)/2)

 


# Question 3

# From the city data, calculate the mean and standard error for the number of buildings.
# How many people live in neighborhoods that have a number of buildings strictly within 1 standard
# error of the mean?

 

No loops!!

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education