Python for Data Science NPTEL Assignment 3

                     

Course name: Python for Data Science

Link to Enroll: Click Here

These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3


Q1. Choose the appropriate command(s) to filter those booking details whose reservation_status are a No-show?
a. data_hotel_ns datahotel. loc[data_hotel.reservation_status=’No-Show’]
b. data_hotel_ns = data_hotel[ data _hotel.reservation_status = “No-Show’]
c. data hotel_ns = data_hotel.reservation_status.loc[data_hotel.isin([‘No-Show’])]
d. data_hotel_ns = data_hotel.loc [data hotel.reservation_status.isin([ No-Show’])]

Answer:b, d


Q2. From the same data, find how many bookings were not cancelled in the year 2017?

a. 9064
b. 6231
c. 9046
d. None of the above

Answer: a. 9064


Q3. From the total bookings that were made in 2017 and not cancelled, which month had the highest number of repeated guests?
a. July
b. February
c. January
d. None of the above

Answer: c. January


These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3


Q4. Which of the following commands can be used to create a variable Flag, and set the values as Premium when the rating is equal to or greater than 3.25, and otherwise as Regular?

a. dt_cocoa[°Flag’] = [“Premium” if x 3.25 else “Regular” for x in dt_cocoa[‘Rating’ ]]

b. dt_cocoa[“Flag’] = [“Premium” if x 3.25 else “Regular” for x in dt_cocoa[ _` Rating ‘]]
c. dt_cocoa[“Flag”] = np.where(dt_cocoa[ “Rating”] < 3.25, “Regular”, “Premium”)
d. None of the above

Answer: b, c


Q5. Which instruction can be used to impute the missing values in the column Review Data from the dataframe dt_cocoa by grouping the records company–wise?

Answer: a


Q6. After checking the data summary, which feature requires a data conversion considering the data values held?
a. Rating
b. Review Date
c. Company
d. None of the above

Answer: b. Review Date


These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3


Q7What is the maximum average rating for the cocoa companies based out of Guatemala?
a. 43.
b. 53.
c. 42.
d. None of the above

Answer: c. 42.


Q8. Which pandas function is used to stack the dataframes vertically?
a. pd.merge()
b. pd.concat()
c. join()
d. None of the above

Answer: b. pd.concat()


These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3


Q9. Of the following set of statements, which of them can be used to extract the column Direction as a separate dataframe?

a. df_weather[[_`Direction ‘ ]]
b. df_weather.iloc[:,0]
c. df_weather.loc[:.[ ‘Direction ‘]]
d. None of the above

Answer: a, b


These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3


Q10. Which one of these students’ average score across all subjects was the lowest? Which subject has the highest average score across students?

a. Harini, Maths
b. Sathi, Maths
c. Harini, Physics
d. Rekha, Maths

Answer: b. Sathi, Maths


These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3

Python for Data Science NPTEL All weeks: https://progies.in/answers/nptel/python-for-data-science

More NPTEL course answers: https://progies.in/answers/nptel


* The material and content uploaded on this website are for general information and reference purposes only. Please do it by your own first.


These are the answers for course Python for Data Science NPTEL Assignment 3 Week 3