Instantly share code, notes, and snippets.

@adtu

adtu / Assignment-3.py

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Embed Embed this gist in your website.
  • Share Copy sharable link for this gist.
  • Clone via HTTPS Clone using the web URL.
  • Learn more about clone URLs

Spread the word.

Share the link on social media.

Confirm Password *

Username or email *

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 Logo

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?

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?

b. February

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”

Answer: b. dt_cocoa[‘Flag’] = [“Premium” if x >= 3.25 else “Regular” for x in dt_cocoa[ ‘Rating’]]

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()))

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?

b. Review Date

Answer: b. Review Date

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

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()

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

Answer: a. df_weather[[‘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

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

NPTEL Cloud Computing Assignment 3 Answers 2023

NPTEL Cloud Computing Assignment 3 Answers 2023

NPTEL Problem Solving Through Programming In C Week 1 & 2 Assignment Answers 2023

NPTEL Problem Solving Through Programming In C Week 1 & ...

NPTEL Programming In Java Week 6 Assignment Answers 2023

NPTEL Programming In Java Week 6 Assignment Answers 2023

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.

Quizermania Logo

Python for Data Science | NPTEL | Week 3 Answers

This set of MCQ(multiple choice questions) focuses on the  Python for Data Science NPTEL Week 3 Answers

You should practice these questions to improve fundamentals of Data Science needed for various interviews (like company interview, campus interview, walk-in interview), entrance exams, placements and other competitive exams. All the questions in this particular section are based on only “ Python for Data Science NPTEL Week 3 Answers “.

Course layout

Week 1 : Basics of Python Spyder Week 2: Sequence data types & associated operations Week 3: Data frames Week 4:   Case study

NOTE:  You can check your answer immediately by clicking show answer button. Moreover, this set of “Python for Data Science NPTEL Week 3 Answers” contains 10 questions.

Now, start attempting the quiz.

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

Answer: c) Mode

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)

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()

Q5. Which of the following are libraries in Python?

a) Pandas b) Matplotlib c) NumPy d) All of the above

Answer: d) All of the above

Q6. Which of the following variable have null values?

a) ID b) Company c) Review Date d) Rating

Answer: c) Review Date

Q7. Which of the following countries have maximum locations of cocoa manufacturing companies?

a) U.K. b) U.S.A. c) Canada d) France

Answer: b) U.S.A.

Q8. After checking the data summary, which feature requires a data conversion considering the data values held?

a) Rating b) Review date c) Company d) Bean origin

Answer: b) Review date

Q9. What is the maximum rating of chocolates?

a) 1.00 b) 5.00 c) 3.18 d) 4.00

Answer: b) 5.00

Q10. 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]

Q1. Data from the file  “brand_data.csv“  has to be loaded into a pandas dataframe. A snippet of the data is shown below: 0, 1, 2, 2 brand, type, cost, price BR1, clnr, 12, 15 BR2, util, 23, 34 BR3, lux, 189, 191 BR4, txtl, 150, 130

What is the right instruction to read the file into a dataframe df_brand with 4 separate columns?

a) pd.read_csv(“brand_data.csv”, index_col=0, header = 1) b) df_brand = pd.read_csv(“brand_data.csv”, header = 1) c) df_brand = pd.read_csv(“brand_data.csv”, header = None) d) df_brand = pd.read_table(“brand_data.csv”, delimiter = ‘,’, header = 1)

Answer: b), d)

Q2. For the same file above  “brand_data.csv“ , which parameter in pd.read_csv will help to load dataframe df_brand with the selected columns as shown below?

In [17]: df_brand out[17]: brand price 0 BR1 15 1 BR2 34 2 BR3 191 3 BR4 130

a) index_col b) skiprows c) usecols d) None of the above

Q3. Data from the file  “weather.xlsx“  has to be loaded into a pandas dataframe  df_weather  which when printed is as shown below:

Of the following set of statements which of them can be used to move the column “Direction” into a separate dataframe

a) df_weather[[‘Direction’]] b) df_weather[‘Direction’] c) df_weather.loc[:, [‘Direction’]] d) df_weather.iloc[:, 0]

Q4. Referring to the same dataframe df_weather in Question(3), which statement/statements will help to print the last row from the dataframe?

a) print(df_weather.head(-1)) b) print(df_weather.tail(1)) c) print(df_weather[2:3]) d) print(df_weather.iloc[-1])

Q5. In reference to the same dataframe df_weather, we add an additional column ‘Hot_day’ to determine whether the day is hot or not based on the values in the Temperature column. What will the print statement derive? df_weather[‘Hot_dat’] = np.where(df_weather[‘Temperature’] > 40, True, False) print(df_weather[‘Hot_day’][2])

a) True b) SyntaxError c) False d) None of the above

Q6. What statement would give the number of columns in a dataframe df?

a) len(df.columns) b) len(df) c) df.size d) All of the above

Q7. A file  “Students.csv”  contains the attendance and total scores of three separate students. This data is loaded into a dataframe  df_study  and a pandas crosstab is applied on the same dataframe which results in the following output.

Which student scored the maximum average score of all three subjects? Which subject has the best average score for all three students?

a) Harini,Chemistry b) Rekha,Physics c) Harini,Physics d) Rekha,Maths

Q8. The following histogram shows the number of books read in a year:

Python for Data Science NPTEL Week 3 Answers

Find the mean and median in the above histogram.

a) 7, 8 b) 8, 9 c) 8.5, 7 d) 8, 8 e) None of the above

Q9. For the following box plot, which among the given options are the median and the outlier?

week 3 assignment 3 python for data science

a) 15, 52 b) 22, 52 c) 13.5, 29 d) 25, 50

Q10. A dataframe df_logs has the following data.

week 3 assignment 3 python for data science

All the NaN / Null values in the column C1 can be replaced by zero value by executing which of the following statements?

a) df_logs[‘C1’].fillna(0,inplace = True) b) df_logs.fillna(0,inplace = True) c) df_logs.fillna(0,inplace = False) d) df_logs[‘C1’].fillna(df_logs[‘B1’],inplace = True)

<< Prev- Python for Data Science Week 2 Assignment Solutions

>> Next- Python for Data Science Week 4 Assignment Solutions

Programming in Java NPTEL week 1 quiz answers

Nptel – Deep Learning assignment solutions

The above question set contains all the correct answers. But in any case, you find any typographical, grammatical or any other error in our site then kindly  inform us . Don’t forget to provide the appropriate URL along with error description. So that we can easily correct it.

Thanks in advance.

For discussion about any question, join the below comment section. And get the solution of your query. Also, try to share your thoughts about the topics covered in this particular quiz.

Related Posts

Operating system fundamentals | nptel | week 0 assignment 0 solution, nptel operating system fundamentals week 1 assignment solutions, nptel operating system fundamentals week 10 answers, nptel operating system fundamentals week 2 assignment solutions, nptel operating system fundamentals week 3 assignment solutions, nptel operating system fundamentals week 4 assignment solutions, leave a comment cancel reply.

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

  • 1st Central Law Reviews: Expert Legal Analysis & Insights

swayam-logo

  • Review Assignment
  • Announcements
  • About the Course
  • Explore Courses

NPTEL: Exam Registration is open now for July 2023 courses!

Dear Candidate,

Here is a golden opportunity for those who had previously enrolled in this course during the Jan 2023 semester, but could not participate in the exams or were absent/did not pass the exam for this course. This course is being reoffered in July 2023 and we are giving you another chance to write the exam in September 2023 and obtain a certificate based on NPTEL norms. Do not let go of this unique opportunity to earn a certificate from the IITs/IISc.

IMPORTANT instructions for learners - Please read this carefully  

1. The exam date for this course: Sep 24, 2023

2. CLICK HERE to register for the exam.

Please fill the exam form using the same Enrolled email id & make fee payment via the form, as before.

3. Choose from the Cities where exam will be conducted: Exam Cities

4. You DO NOT have to re-enroll in the courses. 

5. You DO NOT have to resubmit Assignments OR participate in the non-proctored programming exams(if applicable) in the previous semester

6. If you do enroll in the July 2023 course, we will take the best average assignment scores/non-proctored programming exam(if applicable) score across the two semesters.

Please check once if you have >= 40/100  in average assignment score and also participated and satisfied the criteria in the non-proctored programming exams(if applicable) that were conducted in Jan 2023 to become eligible for the e-certificate, wherever applicable.

If not, please submit assignments again in the July 2023 course and also participate in the non-proctored programming exams(if applicable) to become eligible for the e-certificate.

We will not be having new assignments or unproctored exams(if applicable) in the previous semester's (Jan 2023) course. 

RECOMMENDATION: If you want to take new assignments and an unproctored exam(if applicable) or brush up on your lessons for the exam, please enroll in the July 2023 course.

Click here to enroll in the current course, links are provided corresponding to the course name.

7. Exam fees: 

If you register for the exam and pay before Aug 14, 2023, 5:00 PM, Exam fees will be Rs. 1000/- per exam .

8. 50% fee waiver for the following categories: 

Students belonging to the SC/ST category: please select Yes for the SC/ST option and upload the correct Community certificate.

Students belonging to the PwD category with more than 40% disability: please select Yes for the option and upload the relevant Disability certificate. 

9. Last date for exam registration: Aug 18, 2023, 5:00 PM (Friday). 

10. Between Aug 14, 2023, 5:00 PM & Aug 18, 2023, 5:00 PM late fee will be applicable.

11. Mode of payment: Online payment - debit card/credit card/net banking/UPI. 

12. HALL TICKET: 

The hall ticket will be available for download tentatively by 2 weeks prior to the exam date. We will confirm the same through an announcement once it is published. 

13. FOR CANDIDATES WHO WOULD LIKE TO WRITE MORE THAN 1 COURSE EXAM:- you can add or delete courses and pay separately – till the date when the exam form closes. Same day of exam – you can write exams for 2 courses in the 2 sessions. Same exam center will be allocated for both the sessions. 

14. Data changes: 

Last date for data changes: Aug 18, 2023, 5:00 PM :  

We will charge an additional fee of Rs. 200 to make any changes related to name, DOB, photo, signature, SC/ST and PWD certificates after the last date of data changes.

The following 6 fields can be changed (until the form closes) ONLY when there are NO courses in the course cart. And you will be able to edit those fields only if you: - 

REMOVE unpaid courses from the cart And/or - CANCEL paid courses 

1. Do you come under the SC/ST category? * 

2. SC/ST Proof 

3. Are you a person with disabilities? * 

4. Are you a person with disabilities above 40%? 

5. Disabilities Proof 

6. What is your role? 

Note: Once you remove or cancel a course, you will be able to edit these fields immediately. 

But, for cancelled courses, refund of fees will be initiated only after 2 weeks. 

15. LAST DATE FOR CANCELLING EXAMS and getting a refund: Aug 18, 2023, 5:00 PM  

16. Click here to view Timeline and Guideline : Guideline

Domain Certification

Domain Certification helps learners to gain expertise in a specific Area/Domain. This can be helpful for learners who wish to work in a particular area as part of their job or research or for those appearing for some competitive exam or becoming job ready or specialising in an area of study.  

Every domain will comprise Core courses and Elective courses. Once a learner completes the requisite courses per the mentioned criteria, you will receive a Domain Certificate showcasing your scores and the domain of expertise. Kindly refer to the following link for the list of courses available under each domain: https://nptel.ac.in/domains

Outside India Candidates

Candidates who are residing outside India may also fill the exam form and pay the fees. Mode of exam and other details will be communicated to you separately.

Thanks & Regards, 

Thank you for learning with NPTEL!!

Dear Learner, Thank you for taking the course with NPTEL!! Hope you enjoyed the journey with us. The results for this course have been published and we are closing this course now.  You will still have access to the contents and assignments of this course, if you click on the course name from the " Mycourses " tab on swayam.gov.in . For any further queries please write to [email protected] . - NPTEL Team

Python for Data Science : Result Published!!

Dear Candidate, The exam scores and E Certificates have been released for March 2023 Exam(s). Step 1 - Are the results of my courses released? Please check the Results published courses list in the below links.:- March 2023 Exam - Click here Step 2 - How to check Results? Please login to internalapp.nptel.ac.in/ . and check your exam results. Use the same login credentials as used to register to the exam. What's next? Please read the pass criteria carefully and check against what you have gotten. If you still have any issues, please report the same here. internalapp.nptel.ac.in/ . We will reply within a week. Last date to report queries: 3 days within publishing of scores. Note : Hard copies of certificates will not be dispatched. The duration shown in the certificate will be based on the timeline of offering of the course in 2023, irrespective of which Assignment score that will be considered. Thanks and Best wishes. NPTEL Team

Python for Data Science : Final Feedback Form !!!

Dear students, We are glad that you have attended the NPTEL online certification course. We hope you found the NPTEL Online course useful and have started using NPTEL extensively. In this regard, we would like to have feedback from you regarding our course and whether there are any improvements, you would like to suggest.   We are enclosing an online feedback form and would request you to spare some of your valuable time to input your observations. Your esteemed input will help us in serving you better. The link to give your feedback is: https://docs.google.com/forms/d/1GEOjhbEsWInbpCMzFKe81TUj1i_7eFYSyZgDWTOrCZY/viewform We thank you for your valuable time and feedback. Thanks & Regards, -NPTEL Team

March 2023 NPTEL Exams - Hall Tickets Released!

***THIS IS APPLICABLE ONLY FOR EXAM REGISTERED CANDIDATES*** Dear Candidate, Your Hall Ticket / admit card for the NPTEL Exam(s) in March, 2023 has been released. Please login to https://internalapp.nptel.ac.in/ using your exam registered email id and download your hall ticket. Note:  Requests for changes in exam city, exam center, exam date, session, or course will NOT be entertained. Please write to [email protected] for any further queries. All the best for your exams! Warm Regards NPTEL Team

Exam Format - March, 2023 !!

Dear Candidate, ****This is applicable only for the exam registered candidates**** Type of exam will be available in the list: Click Here You will have to appear at the allotted exam center and produce your Hall ticket and Government Photo Identification Card (Example: Driving License, Passport, PAN card, Voter ID, Aadhaar-ID with your Name, date of birth, photograph and signature) for verification and take the exam in person.  You can find the final allotted exam center details in the hall ticket. The hall ticket is yet to be released.  We will notify the same through email and SMS. Type of exam: Computer based exam (Please check in the above list corresponding to your course name) The questions will be on the computer and the answers will have to be entered on the computer; type of questions may include multiple choice questions, fill in the blanks, essay-type answers, etc. Type of exam: Paper and pen Exam  (Please check in the above list corresponding to your course name) The questions will be on the computer. You will have to write your answers on sheets of paper and submit the answer sheets. Papers will be sent to the faculty for evaluation. On-Screen Calculator Demo Link: Kindly use the below link to get an idea of how the On-screen calculator will work during the exam. https://tcsion.com/ OnlineAssessment/ ScientificCalculator/ Calculator.html NOTE: Physical calculators are not allowed inside the exam hall. Thank you! -NPTEL Team

Python for Data Science : Assignment 1&2 Reevaluations!!

Dear Learners, Assignment 1&2 submissions of all students has been reevaluated by making the weightage as 0 for Question 7. Students are requested to find their revised scores of Assignment 1&2 on the Progress page. -NPTEL Team

Week 4 Feedback Form: Python for Data Science

Dear Learners, Thank you for continuing with the course and hope you are enjoying it. We would like to know if the expectations with which you joined this course are being met and hence please do take 2 minutes to fill out our weekly feedback form. It would help us tremendously in gauging the learner experience. Here is the link to the form:    https://docs.google.com/forms/d/139VEnDqJl8DdxrY9LyuuzNzzEs7qCjaI9wjJJ_n2ZBg/viewform Thank you -NPTEL team

Python for Data Science : Assignment 4 is live now!!

Dear Learners, The lecture videos for Week 4 have been uploaded for the course "Python for Data Science" . The lectures can be accessed using the following link:   Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=56&lesson=57 The other lectures in this week are accessible from the navigation bar to the left. Please remember to login into the website to view contents (if you aren't logged in already). Practice Assignment-4 for Week-4 is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=56&assessment=97 Assignment-4 for Week-4 is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=56&assessment=105 The assignment has to be submitted on or before Wednesday,[22/02/2023], 23:59 IST. As we have done so far, please use the discussion forums if you have any questions on this module. Note : Please check the due date of the assignments in the announcement and assignment page if you see any mismatch write to us immediately. Thanks and Regards, -NPTEL Team

Week 3 Feedback Form: Python for Data Science

Python for data science : assignment 3 is live now.

Dear Learners, The lecture videos for Week 3 have been uploaded for the course "Python for Data Science" . The lectures can be accessed using the following link:   Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=41&lesson=42 The other lectures in this week are accessible from the navigation bar to the left. Please remember to login into the website to view contents (if you aren't logged in already). Practice Assignment-3 for Week-3 is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=41&assessment=96 Assignment-3 for Week-3 is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=41&assessment=104 The assignment has to be submitted on or before Wednesday,[15/02/2023], 23:59 IST. As we have done so far, please use the discussion forums if you have any questions on this module. Note : Please check the due date of the assignments in the announcement and assignment page if you see any mismatch write to us immediately. Thanks and Regards, -NPTEL Team

Week 2 Feedback Form: Python for Data Science

Python for data science : assignment 2 is live now.

Dear Learners, The lecture videos for Week 2  have been uploaded for the course "Python for Data Science" . The lectures can be accessed using the following link:   Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&lesson=31 The other lectures in this week are accessible from the navigation bar to the left. Please remember to login into the website to view contents (if you aren't logged in already). Practice Assignment-2  for Week-2  is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=95 Assignment-2  for Week-2  is also released and can be accessed from the following link Link: https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=30&assessment=103 The assignment has to be submitted on or before Wednesday,[08/02/2023], 23:59 IST. As we have done so far, please use the discussion forums if you have any questions on this module. Note : Please check the due date of the assignments in the announcement and assignment page if you see any mismatch write to us immediately. Thanks and Regards, -NPTEL Team

Week 1 Feedback Form: Python for Data Science

Dear Learner Thank you for continuing with the course and hope you are enjoying it. We would like to know if the expectations with which you joined this course are being met and hence please do take 2 minutes to fill out our weekly feedback form. It would help us tremendously in gauging the learner experience. Here is the link to the form:  https://docs.google.com/forms/d/139VEnDqJl8DdxrY9LyuuzNzzEs7qCjaI9wjJJ_n2ZBg/viewform Thank you -NPTEL team

Python for Data Science : Assignment 1 is live now!!

Dear Learners, The lecture videos for Week 1 have been uploaded for the course "Python for Data Science" . The lectures can be accessed using the following link:   Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=18&lesson=19 The other lectures in this week are accessible from the navigation bar to the left. Please remember to login into the website to view contents (if you aren't logged in already). Practice Assignment-1 for Week-1 is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=18&assessment=94 Assignment-1 for Week-1 is also released and can be accessed from the following link Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=18&assessment=102 The assignment has to be submitted on or before Wednesday,[08/02/2023], 23:59 IST. As we have done so far, please use the discussion forums if you have any questions on this module. Note : Please check the due date of the assignments in the announcement and assignment page if you see any mismatch write to us immediately. Thanks and Regards, -NPTEL Team

Python for Data Science : Assignment 0 is live now!!

Dear Learners, We welcome you all to this course "Python for Data Science" . The assignment 0 has been released. This assignment is based on a prerequisite of the course. You can find the assignment in the link : https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=16&assessment=93 Please note that this assignment is for practice and it will not be graded. Thanks & Regards   -NPTEL Team

Python for Data Science - Week-1 video is live now !!

Dear Learners, The lecture videos for Week 1 have been uploaded for the course “ Python for Data Science ”. The lectures can be accessed using the following link: Link:  https://onlinecourses.nptel.ac.in/noc23_cs21/unit?unit=18&lesson=19 The other lectures in this week are accessible from the navigation bar to the left. Please remember to login into the website to view contents (if you aren't logged in already). Assignment will be released shortly. As we have done so far, please use the discussion forums if you have any questions on this module. Thanks and Regards, -NPTEL Team

NPTEL: Exam Registration is open now for Jan 2023 courses!

Dear Learner, 

Here is the much-awaited announcement on registering for the Jan 2023 NPTEL course certification exam. 

1. The registration for the certification exam is open only to those learners who have enrolled in the course. 

2. If you want to register for the exam for this course, login here using the same email id which you had used to enroll to the course in Swayam portal. Please note that Assignments submitted through the exam registered email id ALONE will be taken into consideration towards final consolidated score & certification. 

3 . Date of exam: Mar 26, 2023

CLICK HERE to register for the exam. 

Choose from the Cities where exam will be conducted: Exam Cities

4. Exam fees: 

If you register for the exam and pay before Feb 17, 2023, 5:00 PM, Exam fees will be Rs. 1000/- per exam .

5. 50% fee waiver for the following categories: 

6. Last date for exam registration: Feb 17, 2023, 5:00 PM (Friday). 

7. Mode of payment: Online payment - debit card/credit card/net banking/UPI. 

8. HALL TICKET: 

The hall ticket will be available for download tentatively by 2 weeks prior to the exam date . We will confirm the same through an announcement once it is published. 

9. FOR CANDIDATES WHO WOULD LIKE TO WRITE MORE THAN 1 COURSE EXAM:- you can add or delete courses and pay separately – till the date when the exam form closes. Same day of exam – you can write exams for 2 courses in the 2 sessions. Same exam center will be allocated for both the sessions. 

10. Data changes: 

Last date for data changes: Feb 17, 2023, 5:00 PM :  

All the fields in the Exam form except for the following ones can be changed until the form closes. 

The following 6 fields can be changed ONLY when there are NO courses in the course cart. And you will be able to edit the following fields only if you: - 

6. What is your role ? 

11. LAST DATE FOR CANCELLING EXAMS and getting a refund: Feb 17, 2023, 5:00 PM  

12. Click here to view Timeline and Guideline : Guideline

Python for Data Science: Welcome to NPTEL Online Course - Jan 2023!!

  • Every week, about 2.5 to 4 hours of videos containing content by the Course instructor will be released along with an assignment based on this. Please watch the lectures, follow the course regularly and submit all assessments and assignments before the due date. Your regular participation is vital for learning and doing well in the course. This will be done week on week through the duration of the course.
  • Please do the assignments yourself and even if you take help, kindly try to learn from it. These assignments will help you prepare for the final exams. Plagiarism and violating the Honor Code will be taken very seriously if detected during the submission of assignments.
  • The announcement group - will only have messages from course instructors and teaching assistants - regarding the lessons, assignments, exam registration, hall tickets, etc.
  • The discussion forum (Ask a question tab on the portal) - is for everyone to ask questions and interact. Anyone who knows the answers can reply to anyone's post and the course instructor/TA will also respond to your queries.
  • Please make maximum use of this feature as this will help you learn much better.
  • If you have any questions regarding the exam, registration, hall tickets, results, queries related to the technical content in the lectures, any doubts in the assignments, etc can be posted in the forum section
  • The course is free to enroll and learn from. But if you want a certificate, you have to register and write the proctored exam conducted by us in person at any of the designated exam centres.
  • The exam is optional for a fee of Rs 1000/- (Rupees one thousand only).
  • Date and Time of Exams: March 26, 2023  Morning session 9am to 12 noon; Afternoon Session 2 pm to 5 pm.
  • Registration URL: Announcements will be made when the registration form is open for registrations.
  • The online registration form has to be filled and the certification exam fee needs to be paid. More details will be made available when the exam registration form is published. If there are any changes, it will be mentioned then.
  • Please check the form for more details on the cities where the exams will be held, the conditions you agree to when you fill the form etc.
  • Once again, thanks for your interest in our online courses and certification. Happy learning.

A project of

week 3 assignment 3 python for data science

In association with

week 3 assignment 3 python for data science

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

NPTEL Python For Data Science Assignment Answer

NPTEL Python For Data Science Assignment Answer 2023

Table of Contents:-

NPTEL Python For Data Science Week 3 Assignment Answer 2023

1. Which of the following is the correct approach to fill missing values in case of categorical variable?

  • None of the above

2. 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’]]

3. The method df_cars.describe() will give description of which of the following column?

  • Price (in lakhs)
  • All of the above

4. Which pandas function is used to stack the dataframes vertically?

  • pd.concat()

5. Which of the following are libraries in Python?

6. Which of the following variable have null values?

  • Review Date

7. Which of the following countries have maximum locations of cocoa manufacturing companies?

8. After checking the data summary, which feature requires a data conversion considering the data values held?

  • Review date
  • Bean origin

9. What is the maximum rating of chocolates?

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

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

NPTEL Python For Data Science Week 2 Assignment Answer 2023

1. Which of the following object does not support ind e xing?

  • dict i onary

2. Given a NumPy array, arr = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]), what is the output of the command, print(arr[0][1])?

  • [[1 2 3] [4 5 6] [7 8 9]

3. What is the output of the following code?

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • [2, 3, 4, 5]
  • [1, 2, 3, 4]
  • Will throw an error: Set objects are no t iterable.

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

5. Which of the following code gives output My friend’s house is in Chennai?

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

6. Let t1=(1,2, “tuple”,4) and t2=(5,6,7). Which of the follo w ing will not give any error after the execution?

  • t1.append(5)
  • x=t2[t1[1]]
  • t3=(t1 , t2)
  • t3=(list(t1), list(t2))

7. Let d={1:“Pyhton”,2:[1,2,3]}. Which among the fol l owing will not give the error after the execution?

  • d[2].append(4)
  • d.update({‘one’ : 22})

8. Wh i ch of the following data type is immutable?

9. student = {‘name’: ‘Jane’, ‘age’: 25 , ‘courses’: [‘Math’, ‘Statistics’]} Which among the following will return {‘name’: ‘Jane’, ‘age’: 26, ‘courses’: [‘Math’ , ‘Statistics’], ‘phone’: ‘123-456’}?

  • student.update({‘age’ : 26})
  • student.update({‘age’ : 26, ‘phone’: ‘123-456’}) 
  • student[‘phone’] = ‘123-456’

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

[‘M’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’] [‘m’, ‘a’, ‘h’, ‘e’, ‘s’ , ‘h’] [‘M’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’] [‘m’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]

NPTEL Python For Data Science Week 1 Assignment Answer 2023

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

  • Code will throw an error.

4. Which of the following variable names are INVALID in Python?

  • variable_ 1

5. While naming the variable, use of any special character other than unders c ore(_) ill throw which type of error?

  • Syntax error
  • Value er r or
  • Index error

6. Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?

  • str(float,x)
  • x.flo a t()
  • Cannot convert a string to float data type

7. Which Python library is commonly used for data wrangling and manipulation?

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

9. Given two variables, j = 6 and g = 3.3. If both normal division and floor division operators were used to divide j by g, what would be the data type of the value obtained from the operations?

  • float, float

[Week 3] NPTEL Python For Data Science Assignment Answer 2023

Leave a comment Cancel reply

Save my name, email, and website in this browser for the next time I comment.

NPTEL Python for Data Science Assignment 3 Answers 2023

NPTEL Python for Data Science Assignment 3 Answers 2023:-  All the Answers provided below to help the students as a reference, You must submit your assignment at your own knowledge.

NPTEL Python For Data Science Week 3 Assignment Answer 2023

1. Which of the following is the correct approach to fill missing values in case of categorical variable?

  • None of the above

2. 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’]]

3. The method df_cars.describe() will give description of which of the following column?

  • Price (in lakhs)
  • All of the above

4. Which pandas function is used to stack the dataframes vertically?

  • pd.concat()

5. Which of the following are libraries in Python?

6. Which of the following variable have null values?

  • Review Date

7. Which of the following countries have maximum locations of cocoa manufacturing companies?

8. After checking the data summary, which feature requires a data conversion considering the data values held?

  • Review date
  • Bean origin

9. What is the maximum rating of chocolates?

NPTEL Python for Data Science Assignment 3 Answers 2023

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

NPTEL Python for Data Science Assignment 3 Answers 2022 [July-Dec]

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

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

Answers will be Uploaded Shortly and it will be Notified on Telegram, So  JOIN NOW

NPTEL Python for Data Science Assignment 3 Answers 2023

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

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

5. 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?

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

👇 For Week 04 Assignment Answers 👇

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

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

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

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

For More NPTEL Answers:-  CLICK HERE Join Our Telegram:-  CLICK HERE

About Python For Data Science

The course aims at equipping participants to be able to use python programming for solving data science problems.

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of average of best 3 assignments out of the total 4 assignments given in the course. Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

NPTEL Python for Data Science Assignment 3 Answers [Jan 2022]

Q1. Data from the file “brand_data.csv“ has to be loaded into a pandas dataframe. A snippet of the data is shown below:

NPTEL Python for Data Science Assignment 3 Answers 2023

What is the right instruction to read the file into a dataframe df_brand with 4 separate columns?

Answer:- (B), (C) & (D)

👇 FOR NEXT WEEK ASSIGNMENT ANSWERS 👇

Q2. For the same file above “brand_data.csv“ , which parameter in pd.read_csv will help to load dataframe df_brand with the selected columns as shown below?

NPTEL Python for Data Science Assignment 3 Answers 2023

(A) index_col  (B) skiprows  (C) usecols  (D) None of the above

Answer:- (C) usecols 

Q3. Data from the file “weather.xlsx“ has to be loaded into a pandas dataframe df_weather which when printed is as shown below:

NPTEL Python for Data Science Assignment 3 Answers 2023

Of the following set of statements which of them can be used to move the column “Direction” into a separate dataframe

Answer:- (A), (B), (C) & (D)

Q4. Referring to the same dataframe df_weather in Question (3), which statement/statements will help to print the last row from the dataframe?

Answer:- (B) & (D)

Q5. In reference to the same dataframe df_weather, we add an additional column ‘Hot_day’ to determine whether the day is hot or not based on the values in the Temperature column. What will the print statement derive?

NPTEL Python for Data Science Assignment 3 Answers 2023

(A) True  (B) SyntaxError  (C) False  (D) None of the above

Answer:- (C) False 

Q6. What statement would give the number of columns in a dataframe df?

(A) len(df.columns)  (B) len(df)  (C) df.size  (D) All of the above

Answer:- (A) len(df.columns) 

Q7. A file “Students.csv” contains the attendance and total scores of three separate students. This data is loaded into a dataframe df_study and a pandas crosstab is applied on the same dataframe which results in the following output

NPTEL Python for Data Science Assignment 3 Answers 2023

Which student scored the maximum average score of all three subjects? Which subject has the best average score for all three students?

(A) Harini,Chemistry  (B) Rekha,Physics  (C) Harini,Physics  (D) Rekha,Maths

Answer:- (D) Rekha,Maths

Q8. The following histogram shows the number of books read in a year:

NPTEL Python for Data Science Assignment 3 Answers 2023

Find the mean and median in the above histogram.

(A) 7,8  (B) 8,9  (C) 8.5,7  (D) 8,8  (E) None of the above

Answer:- (D) 8,8 

Q9. For the following box plot, which among the given options are the median and the outlier?

NPTEL Python for Data Science Assignment 3 Answers 2023

(A) 15, 52  (B) 22, 52  (C) 13.5, 29  (D) 25, 50

Answer:- (B) 22, 52 

Q10. A dataframe df_logs has the following data.

NPTEL Python for Data Science Assignment 3 Answers 2023

All the NaN / Null values in the column C1 can be replaced by zero value by executing which of the following statements?

(A) df_logs[‘C1’].fillna(0,inplace = True)  (B) df_logs.fillna(0,inplace = True)  (C) df_logs.fillna(0,inplace = False)  (D) df_logs[‘C1’].fillna(df_logs[‘B1’],inplace = True)

Answer:- (A) df_logs[‘C1’].fillna(0,inplace = True) 

Disclaimer :- We do not claim 100% surety of solutions, these solutions are based on our sole expertise, and by using posting these answers we are simply looking to help students as a reference, so we urge do your assignment on your own.

For More NPTEL Answers:-  CLICK HERE

Join Our Telegram:-  CLICK HERE

NPTEL Python for Data Science Assignment 3 Answers 2022:-  All the Answers provided below to help the students as a reference, You must submit your assignment at your own knowledge.

Leave a Comment Cancel reply

You must be logged in to post a comment.

[Week 1-4] NPTEL Python For Data Science Assignment Answers 2023

NPTEL Python For Data Science Assignment Answer 2023

NPTEL Python For Data Science Assignment Answers

Table of Contents

NPTEL Python For Data Science Week 4 Assignment Answer 2023

1. Which of the following are regression problems? Assume that appropriate data is given.

  • Predicting the house price.
  • Predicting w h ether it will rain or not on a given day.
  • Predicting the maximum temperature on a g iven day.
  • Predicting the sales of the ice-creams.

2. Which of the followings are binary classification problems?

  • Predicting whether a patient is diagnosed with cancer or not.
  • Predicting whether a team will win a tournament or not.
  • Predicting the price of a second-hand car.
  • Classify web text into one of the follow in g categories: Sports, Entertainment, or Technology.

3. If a linear regression model achieves zero training error, can we say that all the data points lie on a hyperplane in the (d+1)-dimensional space? Here, d is the nu m ber of features.

Read the information given below and answer the questions from 4 to 6: Data Description: An automotive service chain is launching its new grand service station this weekend. They offer to service a wide variety of cars. The current capacity of the station is to check 315 cars thoroughly per day. As an inaugural offer, they claim to freely check all cars that arrive on their launch day, and report whether they need servicing or not!

Unexpectedly, they get 450 cars. The servicemen will not work longer than the working hours, but the data analysts have to!

Can you save the day for the new service station?

How can a data scientist save the day for them?

He has been given a data set, ‘ ServiceTrain.csv ’ that contains some attributes of the car that can be easily measured and a conclusion that if a service is needed or not.

Now for the cars they cannot check in detail, they measure those attributes and store them in ‘ ServiceTest.csv ’

Problem Statement:

Use machine learning techniques to identify whether the cars require service or not

Read the given datasets ‘ ServiceTrain.csv ’ and ‘ ServiceTest.csv ’ as train data and test data respectively and import all the required packages for analysis.

4. Which of the following machine learning techniques would NOT be ap p ropriate to solve the problem given in the problem statement?

  • Random Forest
  • Logisti c Regression
  • Linear regression

5. After applying logistic regression, what is/are the correct observat ion s from the resultant confusion matrix?

  • True Positive = 29, True Negative = 94
  • True Positive = 94, Tr u e Negative = 29
  • False Positive = 5, True Negative = 94
  • None of the above

Prepare the data by following th e steps given below, and answer questions 6 and 7.

  • Encode categorical variable, Service – Yes as 1 and No as 0 for both the train and test datasets.
  • Split the set of independent features and the dependent feature on both the train and test datasets.
  • Set random_state for the instance of the logistic regression class as 0.

6. The logistic regression model built between the input and output variables is checked for its prediction accuracy of the test data. What is the accuracy range (in %) of the predictions made over test dat a ?

  • 60 – 79
  • 90 – 9 5

7. How are categorical variables preprocessed before m odel building?

  • Standardization
  • Dummy var i ables
  • Correlation

The Global Happiness Index report contains the Happiness Score data w i th multiple features (namely the Economy, Family, Health, and Freedom) that could affect the target variable value.

Prepare the data by following the steps g iven below, and answer question 8

  • Split the set of independent features and the dependent feature on the given dataset
  • Create training and testing data from the set of independent features and dependent feature by splitting the original data in the ratio 3:1 respectively, and set the value for random_state of the training/test split method’s instance as 1

8. A multiple linear regression model is built on the Global Happiness Index dat a set ‘GHI_Report.csv’. What is the RMSE of the baseline model?

9. A regression model with the following function y=60+5.2x was built to understand the impact of humidity (x) on rainfall (y). The humidity this week is 30 more than the previous week. Wh a t is the predicted difference in rainfall?

10. X and Y are two variables that have a strong linear relationship. Whi c h of the following statements are incorrect?

  • There cannot be a negative relationship between the two variables.
  • The relationship between the two variables is purely causal.
  • One variable may or may not cause a change in the other variable.
  • The variables can be positively or negativel y correlated with each other

NPTEL Python For Data Science Week 3 Assignment Answer 2023

1. Which of the following is the correct approach to fill missing values in case of categorical variable?

2. 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’]]

3. The method df_cars.describe() will give description of which of the following column?

  • Price (in lakhs)
  • All of the above

4. Which pandas function is used to stack the dataframes vertically?

  • pd.concat()

5. Which of the following are libraries in Python?

6. Which of the following variable have null values?

  • Review Date

7. Which of the following countries have maximum locations of cocoa manufacturing companies?

8. After checking the data summary, which feature requires a data conversion considering the data values held?

  • Review date
  • Bean origin

9. What is the maximum rating of chocolates?

a3q10

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

NPTEL Python For Data Science Week 2 Assignment Answer 2023

1. Which of the following object does not support ind e xing?

  • dict i onary

2. Given a NumPy array, arr = np.array([[[1, 2, 3], [4, 5, 6], [7, 8, 9]]]), what is the output of the command, print(arr[0][1])?

  • [[1 2 3] [4 5 6] [7 8 9]

3. What is the output of the following code?

a2q3

  • [2, 3, 4, 5]
  • [1, 2, 3, 4]
  • Will throw an error: Set objects are no t iterable.

a2q4

5. Which of the following code gives output My friend’s house is in Chennai?

a2q5a

6. Let t1=(1,2, “tuple”,4) and t2=(5,6,7). Which of the follo w ing will not give any error after the execution?

  • t1.append(5)
  • x=t2[t1[1]]
  • t3=(t1 , t2)
  • t3=(list(t1), list(t2))

7. Let d={1:“Pyhton”,2:[1,2,3]}. Which among the fol l owing will not give the error after the execution?

  • d[2].append(4)
  • d.update({‘one’ : 22})

8. Wh i ch of the following data type is immutable?

9. student = {‘name’: ‘Jane’, ‘age’: 25 , ‘courses’: [‘Math’, ‘Statistics’]} Which among the following will return {‘name’: ‘Jane’, ‘age’: 26, ‘courses’: [‘Math’ , ‘Statistics’], ‘phone’: ‘123-456’}?

  • student.update({‘age’ : 26})
  • student.update({‘age’ : 26, ‘phone’: ‘123-456’}) 
  • student[‘phone’] = ‘123-456’

a2q10

[‘M’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’] [‘m’, ‘a’, ‘h’, ‘e’, ‘s’ , ‘h’] [‘M’, ‘a’, ‘h’, ‘e’, ‘s’, ‘h’] [‘m’, ‘A’, ‘H’, ‘E’, ‘S’, ‘H’]

NPTEL Python For Data Science Week 1 Assignment Answer 2023

A1Q1

  • Error: Invalid operation, unsupported operator ‘*’ used between ‘int’ and ‘str’

A1Q2

  • Code will throw an error.

4. Which of the following variable names are INVALID in Python?

  • variable_ 1

5. While naming the variable, use of any special character other than unders c ore(_) ill throw which type of error?

  • Syntax error
  • Value er r or
  • Index error

6. Let x = “Mayur”. Which of the following commands converts the ‘x’ to float datatype?

  • str(float,x)
  • x.flo a t()
  • Cannot convert a string to float data type

7. Which Python library is commonly used for data wrangling and manipulation?

A1Q8

9. Given two variables, j = 6 and g = 3.3. If both normal division and floor division operators were used to divide j by g, what would be the data type of the value obtained from the operations?

  • float, float

A1Q10n

Share your love

Related posts.

NPTEL Introduction To Machine Learning - IITKGP Assignment Answer 2023

[Week 1 to 8] NPTEL Introduction To Machine Learning – IITKGP Assignment Answers 2023

[week 1] nptel deep learning – iit ropar assignment answers 2024, which of the following is/are not a type of transducer.

NPTEL Introduction To Machine Learning Assignment Answer 2023

[Week 1-12] NPTEL Introduction To Machine Learning Assignment Answer 2023

[week 1] nptel data analytics with python assignment answers 2024.

[Week 3] NPTEL Computer Graphics Assignment Answers 2023

[Week 1-4] NPTEL Computer Graphics Assignment Answers 2023

Leave a comment cancel reply.

Your email address will not be published. Required fields are marked *

Save my name, email, and website in this browser for the next time I comment.

week 3 assignment 3 python for data science

Programming for Data Science

Teaching data scientists the tools they need to use computers to do data science

Creative Commons License

Advanced Python for Data Science Assignment 3

All assigments beginning with Assignment 3 are to be submitted via GitHub. Create a new repository for each assignment using your NetID, an underscore ‘_’, the word ‘assignment’ and the assignment number, all in lower case. For example, if your NetID is aaa11 then the repository for this assignment would be aaa11_assignment3 . Clone this repository to your local computer. Commit any files that you are required to create as part of the assignment, then push the changes back to GitHub. Whatever is in the repository at the due date will be graded.

An astrophysicist colleague was recently complaining about how long it was taking to run an N-body simulation. “It’s really just a simple calculation, and I’m only simulating four planets, but it takes nearly a minute and a half to run one simulation. I really need it done in under 30 seconds.” You kindly offer to take a look at code to see if it is possible to speed it up. Your colleague provides you with a link to the source .

Although your colleague said the code was simple, it is still fairly complex, so you decide to tackle the problem in stages. A first scan of the code reveals a number of potential areas that could be improved. These include:

  • Reducing function call overhead
  • Using alternatives to membership testing of lists
  • Using local rather than global variables
  • Using data aggregation to reduce loop overheads

As you’re a cautious programmer, you decide to address each of these in turn. This will ensure that it is possible to check the program is still working correctly after each change, and to assess the performance improvement that the change achieved. You are also aware that the program has to be maintained by others in the future, so you want to make sure that the changes do not make this more difficult, especially if the performance improvement is only minor.

For each of these areas, create a new version of nbody.py (call them nbody_1.py , nbody_2.py , etc.) and commit them to the repository. You may also add a file with any other optimizations that you find. At the beginning of each file, put a comment indicating if the change made the most improvement, second most, etc. Finally, create another file called nbody_opt.py that contains all of the optimizations you made. Put a comment at the top indicating the relative speedup of the optimized version compared to the original version. Calculate the relative speedup (R) as follows:

week 3 assignment 3 python for data science

Are you able to get it to run in under 30 seconds?

  • Wednesday, April 3, 2024

NPTEL Programming, Data Structures And Algorithms Using Python Week3 Assignment

NPTEL-Programming-Data-Structures-And-Algorithms-Using-Python-Week3-Assignment

NPTEL Course is an introduction to programming and problem solving in Python.  It does not assume any prior knowledge of programming.  Using some motivating examples, the course quickly builds up basic concepts such as conditionals, loops, functions, lists, strings and tuples.  It goes on to cover searching and sorting algorithms, dynamic programming and backtracking, as well as topics such as exception handling and using files.  As far as data structures are concerned, the course covers Python dictionaries as well as classes and objects for defining user defined datatypes such as linked lists and binary search trees.

Programming, Data Structures And Algorithms Using Python Week3 Assignment Jan 2024

INTENDED AUDIENCE :  Students in any branch of mathematics/science/engineering, 1st year  PREREQUISITES : School level mathematics INDUSTRY SUPPORT :   This course should be of value to any company requiring programming skills.

Course Layout

Week 1: Informal introduction to programming, algorithms and data structures via GCD Downloading and installing Python GCD in Python: variables, operations, control flow – assignments, conditionals, loops, functions Week 2: Python: types, expressions, strings, lists, tuples Python memory model: names, mutable and immutable values List operations: slices etc Binary search Inductive function definitions: numerical and structural induction Elementary inductive sorting: selection and insertion sort In-place sorting Week 3: Basic algorithmic analysis: input size, asymptotic complexity, O() notation Arrays vs lists Merge sort Quicksort Stable sorting Week 4: Dictionaries More on Python functions: optional arguments, default values Passing functions as arguments Higher order functions on lists: map, lter, list comprehension Week 5: Exception handling Basic input/output Handling files String processing Week 6: Backtracking: N Queens, recording all solutions Scope in Python: local, global, non-local names Nested functions Data structures: stack, queue Heaps Week 7: Abstract data-types Classes and objects in Python “Linked” lists: find, insert, delete Binary search trees: find, insert, delete Height-balanced binary search trees Week 8: Efficient evaluation of recursive definitions: memorization Dynamic programming: examples Other programming languages: C and manual memory management Other programming paradigms: functional programming

Programming Assignment 1

Write three Python functions as specified below. Paste the text for all three functions together into the submission window. Your function will be called automatically with various inputs and should return values as specified. Do not write commands to read any input or print any output.

  • You may define additional auxiliary functions as needed.
  • In all cases you may assume that the value passed to the function is of the expected type, so your function does not have to check for malformed inputs.
  • For each function, there are normally some public test cases and some (hidden) private test cases.
  • “Compile and run” will evaluate your submission against the public test cases.
  • “Submit” will evaluate your submission against the hidden private test cases. There are 10 private test cases, with equal weightage. You will get feedback about which private test cases pass or fail, though you cannot see the actual test cases.
  • Ignore warnings about “Presentation errors”.

Define a Python function  remdup(l)  that takes a nonempty list of integers  l  and removes all duplicates in  l , keeping only the first occurrence of each number. For instance:

Write a Python function  sumsquare(l)  that takes a nonempty list of integers and returns a list  [odd,even] , where  odd  is the sum of squares all the odd numbers in  l  and  even  is the sum of squares of all the even numbers in  l .

Here are some examples to show how your function should work.

A two dimensional matrix can be represented in Python row-wise, as a list of lists: each inner list represents one row of the matrix. For instance, the matrix

would be represented as  [[1, 2, 3, 4], [5, 6, 7, 8]] .

The transpose of a matrix converts each row into a column. The transpose of the matrix above is:

which would be represented as  [[1, 5], [2, 6], [3, 7], [4, 8]] .

Write a Python function  transpose(m)  that takes as input a two dimensional matrix  m  and returns the transpose of  m .  The argument  m  should remain undisturbed by the function .

Here are some examples to show how your function should work. You may assume that the input to the function is always a non-empty matrix.

IMAGES

  1. Introduction to Data Science in Python Week 3 || Assignment 3 Programming Assignment Coursera

    week 3 assignment 3 python for data science

  2. NPTEL: Python For Data Science Week 3 Assignment 3 Quiz Answers |NPTEL Python DS Course Assignment 3

    week 3 assignment 3 python for data science

  3. NPTEL Python for Data Science Week 3 Quiz Assignment Solutions || August 2020 || Swayam

    week 3 assignment 3 python for data science

  4. NPTEL: Programming ,Data Structures and Algorithms Using Python Week 3

    week 3 assignment 3 python for data science

  5. PYTHON FOR DATA SCIENCE

    week 3 assignment 3 python for data science

  6. NPTEL PYTHON FOR DATA SCIENCE ASSIGNMENT 3 ANSWERS

    week 3 assignment 3 python for data science

VIDEO

  1. Assignment

  2. NPTEL Python for Data Science Week 3 Quiz Assignment Solutions and Answers

  3. NPTEL Data Analytics with Python Week3 Quiz Assignment Solutions

  4. first rule of programming #coding

  5. NPTEL Python for Data Science Week 3 Quiz Assignment Solutions

  6. NPTEL Python for Data Science Week 3 Quiz answers with detailed proof of each answer

COMMENTS

  1. Python for Data Science Week 3 Assignment 3 Solution

    #pythonfordatascience #nptel #swayam #python #datascience Python for Data Science All week Assignment Solution - https://www.youtube.com/playlist?list=PL__28...

  2. Introduction-to-Data-Science-in-Python-Week-3--Assignment-3/code at

    Introduction to Data Science in Python Week 3-Assignment 3 - shikha7m/Introduction-to-Data-Science-in-Python-Week-3--Assignment-3

  3. NPTEL Python for Data Science

    NPTEL Python for Data Science | Week 3:Assignment 3: Answers | Feb 2024 #nptel #datascience #2024 SUBSCRIBE TO MY CHANNEL "Nano ELearn" at: https://www.youtu...

  4. Python For Data Science

    Python For Data Science : Assignment 3 is live now!! Dear Learners, The lecture videos for Week 3 have been uploaded for the course "Python For Data Science". The lectures can be accessed using the following link: ... Assignment-3 for Week-3 is also released and can be accessed from the following link.

  5. Introduction to Data Science in Python Assignment-3 · GitHub

    Also, make sure to exclude the footer and header information from the datafile. The first two columns are unneccessary, so you should get rid of them, and you should change the column labels so that the columns are: # Convert `Energy Supply` to gigajoules (there are 1,000,000 gigajoules in a petajoule). For all countries which have missing data ...

  6. Assignment 3 Solutions

    NPTEL - PYTHON FOR DATA SCIENCE ASSIGNMENT - 3. Types of questions: MCQs - Multiple Choice Questions (a question has only one correct answer) MSQs - Multiple Select Questions (a question can have two, three or four correct options) In this case, equal weightage must be given to all options

  7. GitHub

    This repository includes course assignments of Introduction to Data Science in Python on coursera by university of michigan - tchagau/Introduction-to-Data-Science-in-Python

  8. Python for Data Science Week 3 Assignment 3 Solution

    #pythonfordatascience #nptel #swayam #python #datascience All Weeks Assignment SolutionPython for Data Science - https://www.youtube.com/playlist?list=PL__...

  9. Python for Data Science

    The course aims at equipping participants to be able to use python programming for solving data science problems.INTENDED AUDIENCE : Final Year Undergraduate...

  10. Python for Data Science Assignment Solutions Week 3 2022

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

  11. Python for Data Science

    Week 1: Basics of Python Spyder. Week 2: Sequence data types & associated operations. Week 3: Data frames. Week 4: Case study. NOTE: You can check your answer immediately by clicking show answer button. Moreover, this set of "Python for Data Science NPTEL Week 3 Answers" contains 10 questions. Now, start attempting the quiz.

  12. Python for Data Science

    Week 3 Feedback Form: Python for Data Science Dear Learners, Thank you for continuing with the course and hope you are enjoying it. ... Python for Data Science : Assignment 3 is live now!! Dear Learners, The lecture videos for Week 3 have been uploaded for the course "Python for Data Science". The lectures can be accessed using the following link:

  13. [Week 3] NPTEL Python For Data Science Assignment Answer 2023

    NPTEL Python For Data Science Week 3 Assignment Answer 2023. 1. Which of the following is the correct approach to fill missing values in case of categorical variable? Mean. Median. Mode.

  14. python

    Nov 3, 2019 at 14:50 I don't have a PC right now so I can't check it but I suppose you have empty cell or NaN or ... in the excel - Natthaphon Hongcharoen

  15. Applied-Data-Science-with-Python---Coursera/Introduction to Data

    This project contains all the assignment's solution of university of Michigan. - sapanz/Applied-Data-Science-with-Python---Coursera

  16. PYTHON FOR DATA SCIENCE

    Hello guys, this is the solution for Week 3 of the course Python for Data Science from NPTEL/SWAYAM.-----...

  17. NPTEL Python for Data Science Assignment 3 Answers 2023

    NPTEL Python for Data Science Assignment 3 Answers [Jan 2022] Q1. Data from the file "brand_data.csv" has to be loaded into a pandas dataframe. A snippet of the data is shown below: What is the right instruction to read the file into a dataframe df_brand with 4 separate columns? Answer:-(B), (C) & (D) 👇 FOR NEXT WEEK ASSIGNMENT ANSWERS 👇

  18. [Week 1-4] NPTEL Python For Data Science Assignment Answers 2023

    Answer :- a, c. Prepare the data by following th e steps given below, and answer questions 6 and 7. Encode categorical variable, Service - Yes as 1 and No as 0 for both the train and test datasets. Split the set of independent features and the dependent feature on both the train and test datasets.

  19. Coursera_Intro_to_Data_Science_with_Python/Week3/Assignment

    You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window.

  20. Advanced Python for Data Science Assignment 3

    Advanced Python for Data Science Assignment 3. All assigments beginning with Assignment 3 are to be submitted via GitHub. Create a new repository for each assignment using your NetID, an underscore '_', the word 'assignment' and the assignment number, all in lower case. For example, if your NetID is aaa11 then the repository for this ...

  21. Python For Data Science Week 3: Assignment 3 Answers

    Python For Data Science Week 3: Assignment 3 Answers || July - Dec 2023 || NPTEL1.Software Testing Week 2 : Assignment 2 Solutions || July - 2023 || NPTEL ...

  22. NPTEL Programming, Data Structures And Algorithms Using Python Week3

    Week 6: Backtracking: N Queens, recording all solutions Scope in Python: local, global, non-local names Nested functions Data structures: stack, queue Heaps Week 7: Abstract data-types Classes and objects in Python "Linked" lists: find, insert, delete Binary search trees: find, insert, delete Height-balanced binary search trees Week 8:

  23. NPTEL Python for Data Science Week3 Quiz Assignment Solutions

    🔊NPTEL Python for Data Science Week3 Quiz Assignment Solution 2024 | https://techiestalk.in/⛳ABOUT THE COURSE :The course aims at equipping participants to ...