Sign Up

Sign In

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Sorry, you do not have permission to ask a question, You must login to ask a question.

SIKSHAPATH Latest Articles

Python for Data Science Assignment Solutions Week 3 2022

banner with red stripe on above part texted Nptel on it and Python for data science below to stripe

Are you looking for help in Python for Data Science NPTEL week 3 assignment answers? So, here in this article, we have provided Python for Data Science week 3 assignment answer’s hint.

Python for Data Science NPTEL Assignment Solutions Week 3

Q1. Choose the appropriate command(s) to filter those booking details whose reservation_status are a No-show?

a. data_hotel_ns = data_hotel.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. data_hotel_ns = data_hotel [data_hotel.reservation_status ‘No-Show’]

d. data_hotel_ns = data_hotel.loc[data_hotel.reservation_status.isin([ ‘No-Show’])]

For instant notification of any updates, Join us on telegram.


Q2. From the same data, find how many bookings were not canceled 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 canceled, which month had the highest number of repeated guests?

a. July

b. February

c. January

d. None of the above

Answer: c. January


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. 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”


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?

a. dt_cocoa[‘Review Date’] = dt_cocoa.groupby([‘Company’])[‘Review Date’].apply(lambda x: x.fillna(x.mode().iloc[0]))

b. dt_cocoa[‘Review Date’] = dt_cocoa.groupby([‘Company’])[‘Review Date’].apply(lambda X: x.fillna(x.mean()))

c. dt_cocoa[‘Review Date’] = dt_cocoa.groupby([‘Company’])[‘Review Date’].apply(lambda x: x.fillna(x.mode()))

d. None of the above

Answer: a. dt_cocoa[‘Review Date’] = dt_cocoa.groupby([‘Company’])[‘Review Date’].apply(lambda x: x.fillna(x.mode().iloc[0]))


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


Q7. What is the maximum average rating for the cocoa companies based out of Guatemala?

a. 4

b. 3.5

c. 3.42

d.  None of the above

Answer: c. 3.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()


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. df_weather[[‘Direction’]]

c. df_weather.loc[:, [‘Direction’]]


Q10. A file “Students.csv” contains the attendance and scores of three separate students. This dataset is loaded into a dataframe df_study and a cross table is obtained from the same dataframe which results in the following output

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


TELEGRAM FOR NOTIFICATIONClick Here
Follow on Google News (in one click)Click Here

Disclaimer: These answers are provided only for the purpose to help students to take references. This website does not claim any surety of 100% correct answers. So, this website urges you to complete your assignment yourself.


Also Available:

Python for Data Science NPTEL Assignment Solutions Week 4

Python for Data Science NPTEL Assignment Solutions Week 2

Related Posts

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock