Python for Data Science NPTEL Week 3 Assignment Answers

Are you looking for the Python for Data Science NPTEL Week 3 Assignment Answers 2024? You’ve come to the right place! This guide offers detailed solutions to the Week 3 assignment questions, helping you solidify your understanding of Python programming and its applications in data science.

Course Link: Click Here


Python for Data Science Nptel Week 3 Assignment Answers
Python for Data Science Nptel Week 3 Assignment Answers

Python for Data Science Nptel Week 3 Assignment Answers (July-Dec 2024)


Q1. Which of the following is the correct approach to fill missing values in case of categorical variable?
Mean
median
Mode
None of the above

Answer: Mode


Q2. Of the following set of statements, which of them can be used to extract the column Type as a separate dataframe?
df_cars[[‘Type’]]
df_cars.iloc[[:, 1]
df_cars.loc[:, [‘Type’]]
None of the above

Answer : df_cars[[‘Type’]] , df_cars.loc[:, [‘Type’]]


For answers or latest updates join our telegram channel: Click here to join

These are Python for Data Science Nptel Week 3 Assignment Answers


Q3. The method df_cars.describe() will give description of which of the following column?
Car name
Brand
Price (in lakhs)
All of the above

Answer : Price (in lakhs)


Q4. Which pandas function is used to stack the dataframes vertically?
pd.merge()
pd.concat()
join()
None of the above

Answer: pd.concat()


For answers or latest updates join our telegram channel: Click here to join

These are Python for Data Science Nptel Week 3 Assignment Answers


Q5. Which of the following are libraries in Python?
Pandas
Matplotlib
NumPy
All of the above

Answer: All of the above


Q6. Which of the following variable have null values?
ID
Company
Review Date
Rating

Answer: Review Date


For answers or latest updates join our telegram channel: Click here to join

These are Python for Data Science Nptel Week 3 Assignment Answers


Q7.Which of the following countries have maximum locations of cocoa manufacturing companies?
U.K.
U.S.A.
Canada
France

Answer: U.S.A.


Q8. After checking the data summary, which feature requires a data conversion considering the data values held?
Rating
Review date
Company
Bean origin

Answer: Review date


For answers or latest updates join our telegram channel: Click here to join

These are Python for Data Science Nptel Week 3 Assignment Answers


Q9. What is the maximum rating of chocolates?
1.00
5.00
3.18
4.00

Answer: 5.00


Q10.What is the output of the following code?

[bool, int, float, float, str]
[str, int, float, float, str]
[bool, int, float, int, str]

[bool, int, int, float, str]

Answer: [bool, int, float, float, str]


Q11.What does df.info() provide?
Summary of the DataFrame, including the number of non-null entries.
The first 5 rows of the DataFrame
The data types of the columns
The correlation matrix of the DataFrame

See also  Python for Data Science NPTEL | Week 4

Answer: Summary of the DataFrame, including the number of non-null entries.


Q12.What will be the output of the following code?

[1, 2]
[1, 3, 5]
[1, 2, 3, 4, 5]
[5, 4, 3, 2, 1]

Answer: [1, 3, 5]


For answers or latest updates join our telegram channel: Click here to join

These are Python for Data Science Nptel Week 3 Assignment Answers

Python for Data Science NPTEL All weeks: Click Here

More Nptel Courses: https://progiez.com/nptel-assignment-answers


Python for Data Science NPTEL Week 3 Assignment Answers (Jan-Apr 2024)

Course name: Python For Data Science

Course Link: Click Here


Q1. Which of the following is the correct approach to fill missing values in case of categorical variable?
Mean
Median
Mode
None of the above

Answer: Mode


Q2. Of the following set of statements, which of them can be used to extract the column Type as a separate dataframe?
df_cars[[‘Type’]]
df_cars.iloc[[:, 1]
df_cars.loc[:, [‘Type’]]
None of the above

Answer: a, c


Q3. The method df_cars.describe() will give description of which of the following column?
Car name
Brand
Price (in lakhs)
All of the above

Answer: Price (in lakhs)


These are Python for Data Science NPTEL Week 3 Assignment Answers


Q4. Which pandas function is used to stack the dataframes vertically?
pd.merge()
pd.concat()
join()
None of the above

Answer: pd.concat()


Q5. Which of the following are libraries in Python?
Pandas
Matplotlib
NumPy
All of the above

Answer: All of the above


Q6. Which of the following variable have null values?
ID
Company
Review Date
Rating

Answer: Review Date


These are Python for Data Science NPTEL Week 3 Assignment Answers


Q7. Which of the following countries have maximum locations of cocoa manufacturing companies?
U.K.
U.S.A.
Canada
France

Answer: U.S.A.


Q8. After checking the data summary, which feature requires a data conversion considering the data values held?
Rating
Review date
Company
Bean origin

Answer: Review date


Q9. What is the maximum rating of chocolates?
1.00
5.00
3.18
4.00

Answer: 5.00


Q10. What will be the output of the following code?
[bool, int, float, float, str]
[str, int, float, float, str]
[bool, int, float, int, str]
[bool, int, int, float, str]

Answer: [bool, int, float, float, str]


These are Python for Data Science NPTEL Week 3 Assignment Answers

More Weeks of Python for Data Science: Click here

More Nptel Courses: Click here


Python for Data Science NPTEL Week 3 Assignment Answers (Jan-Apr 2023)

Course Name: Python for Data Science

Course Link: Click Here

These are Python for Data Science NPTEL Week 3 Assignment Answers


Q1. Which of the following is the correct approach to fill missing values in case of categorical variable?
a. Mean
b. Median
c. Mode
d. None of the above

See also  Python for Data Science NPTEL | Week 3

Answer: c. Mode


Assume a pandas dataframe df_cars which when printed is as shown below. Based on this information, answer questions 2 and 3.

Q2. Of the following set of statements, which of them can be used to extract the column Type as a separate dataframe?
a. df cars[[’Type’]]
b. df cars.iloc[[:, 1]
c. df cars.loc[:, [’Type’]]
d. None of the above

Answer: a, c


These are Python for Data Science NPTEL Week 3 Assignment Answers


Q3. The method df_cars.describe() will give description of which of the following column?
a. Car name
b. Brand
c. Price (in lakhs)
d. All of the above

Answer: c. Price (in lakhs)


Q4. 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 Python for Data Science NPTEL Week 3 Assignment Answers


Q5. Which of the following are liabraries in Python?
a. Pandas
b. Matplotlib
c. NumPy
d. All of the above

Answer: d. All of the above


Read the comma-separated values file hotel bookings.csv as a dataframe data hotel and answer questions 6 – 8. Please refer to Hotel Bookings Data Description.pdf for data and variable description.

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

a.

b.

c.

d.

Answer: b, d


These are Python for Data Science NPTEL Week 3 Assignment Answers


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


Q9. 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: a. July


These are Python for Data Science NPTEL Week 3 Assignment Answers


Q9. What will be the output of the following code?

a. [bool, int, float, float, str]
b. [str, int, float, float, str]
c. [bool, int, float, int, str]
d. [bool, int, int, float, str]

Answer: a. [bool, int, float, float, str]


Q10. Which command is used to generate the plot shown below?

a. plt.plot(x, linestyle = “-”)
b. plt.plot(x, linestyle = “–”)
c. plt.plot(x, linestyle = “-.”)
d. plt.plot(x, linestyle = “:”)

Answer: a. plt.plot(x, linestyle = “-”)


These are Python for Data Science NPTEL Week 3 Assignment Answers

More Weeks of Python for Data Science NPTEL: Click here

More NPTEL courses: https://progiez.com/nptel


Python for Data Science NPTEL Week 3 Assignment Answers (July-Dec2022)

Course name: Python for Data Science

Link to Enroll: Click Here

These are Python for Data Science NPTEL Week 3 Assignment Answers


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’])]

See also  Python for Data Science NPTEL | Week 2

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 Python for Data Science NPTEL Week 3 Assignment Answers


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 Python for Data Science NPTEL Week 3 Assignment Answers


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 Python for Data Science NPTEL Week 3 Assignment Answers


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 Python for Data Science NPTEL Week 3 Assignment Answers


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 Python for Data Science NPTEL Week 3 Assignment Answers