Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You are working on an API in python that will be used by a web app and will also be used by other people in

image text in transcribed
image text in transcribed
image text in transcribed
You are working on an API in python that will be used by a web app and will also be used by other people in your organization. One of the endpoint accepts GET requests and should return a list of teachers and each teacher should contain a list of students see the desired outcome below under "The desired outcome" The data Initially, you have 2 dataframes in python, (you have no control of where this data comes from), a teachers dataframe ( and a students dataframe 1 Create these dataframes in python as follows: Create these dataframes in python as follows: import pandas as pd \#dependency import numpy as np \#dependency df teacher =pd. Dataframe ({ "name": ["Pep Guardiola", "Jurgen Klopp", "Mikel Arteta", "Zinadine Zidane"], "married": [True, True, False, True], "school": ["Manchester High School", "Liverpool High School", "Arsenal High", np.n an] 3) df_student =pd. DataFrame( \{ "teacher": ["mikel Arteta", "Mikel Arteta", "Pep Guardiola", "Jurgen Klopp", "Jurg en Klopp", "Jurgen Klopp", "Pep Guardiola", "Pep Guardiola", "Mikel Arteta"], "name": ["Bukayo Saka", "Gabriel Martinelli", "Jack Grealish", "Roberto Firmino", "Andrew Robertson", "Darwin Nunez", "Ederson Moraes", "Manuel Akanji", "Thomas Parte y"], "age": [21,21,27,31,28,23,29,27,29], "height": [2.1m,2.1m,2.1m,2.1m,2.1m,2.1m,2.1m,2.1m,2.1m] You are told that the dataframe, df_student, can and will change in the near future, i.e more columns can be ADDED to the df_student, but none can be DELETED i.e teacher and will ALWAYS be there Again, remember, you have no control of the original source of the data. Any new columns added in df_student, should appear in the final results. for example, if the column weight is added as follows: 3)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions