Question 4 Not complete Marked out of 5.00 Flag question Sometimes data gets corrupted, and for us, it will be indicated

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Question 4 Not complete Marked out of 5.00 Flag question Sometimes data gets corrupted, and for us, it will be indicated

Post by answerhappygod »

Question 4 Not Complete Marked Out Of 5 00 Flag Question Sometimes Data Gets Corrupted And For Us It Will Be Indicated 1
Question 4 Not Complete Marked Out Of 5 00 Flag Question Sometimes Data Gets Corrupted And For Us It Will Be Indicated 1 (138.74 KiB) Viewed 15 times
Question 4 Not complete Marked out of 5.00 Flag question Sometimes data gets corrupted, and for us, it will be indicated by value np.nan (or simply, nan). You are given a code that randomly introduces the nan value into your current dataset for testing (in your skeleton code). For our analysis, we will convert nan values to be the mean value of the rest of the data. For example, if we have data [1, 2, nan, 4, 5, nan], then those nan values will be replaced by (1 + 2 + 4 + 5)/4 = 3 -> [1, 2, 3, 4, 5, 3]. Write a function replace_nan (data) where you replace all nan values in the columns 'valence_intensity', 'anger_intensity', 'fear_intensity', 'sadness_intensity', and 'joy_intensity' to be the mean value of each column. Note: using appropriate NumPy functions and methods, this can be solved in less than 10 lines. Note: don't round your answer. For example: Test Result nan data = unstructured_to_structured (load_metrics ("covid_sentiment_metrics.csv"), [0, 1, 7, 8]) data[:]['created_at'] converting_timestamps (data[:] ['created_at']) = 0.44 np.random.seed (33) #from the skeleton code, randomly adding nan dropout = 0.1 intensity = ['valence_intensity', 'anger_intensity', 'fear_intensity', 'sadness_intensity', 'joy_intensity'] for val in intensity: data[:] [val][np.random.choice(data[:][val].size, int(dropout * data[:][val].size), replace=False)] = np.nan print (data[:]['valence_intensity'][12]) data = replace_nan(data) print (round(data[:]['valence_intensity'][12], 2))

Jx AI created_at A B C D E F G H K M N O P 1 created_at tweet_ID text screen_narfollowers 2 Sat Feb 29 1.23E+18 ###################### friends user ID valence in anger_inte fear_intens sadness_injoy_intensi sentiment emotion_ccountry region ###### #######* ##### #######* 0.458 positive joy 3 Thu Feb 27 1.23E+18 ##################### 0,67 0.442 0.577 4 Mon Feb 1 1.23E+18 ################### 0,293 0.313 0.316 0.385 0.594 0.4 0.429 0.444 0.333 0.418 0.447 0.385 0.401 ###### ### www 5 Sat Feb 29 1.23E+18 ###### www.m ******** www. ####### 0.514 0.914 0.410 0.947 0.255 negative fear 0.446 positive joy 0.351 neutral no specific ####⠀⠀⠀⠀⠀⠀⠀⠀⠀ www.z 0.248 negative fear vergan 0.322 negative anger Omegane 0.262 negative fear we g Z #######‚⠀⠀⠀⠀⠀⠀⠀‚###### wwwwwwwww ###⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ weateus 1.600 www Thu Jan 30 1.22E+18 ###⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ indsatso 1.200 www. wwwww.. 6 Wed Feb 2 1.23E+18 0.426 0.379 0.564 wwwwwwww www. www wwwww 7 0.46 0.453 0.400 XX 0.418 0.366 www X40 wwwwwwwwwwww 8 Sun Mar 0. ############ 0.38 0.52 0.574 0.513 0:00 www **** 1.23E+18 Que Fab 16 100 10 wwwwwwwwww www 9 Sun Feb 16 1.23E+18 #######*⠀⠀⠀⠀⠀⠀⠀*##### 3 ponted a 1.20 10 ********************* wwwwwwww Mon Feb 1 1.23E+18 #######*############ wangers FEREA 0.53 0.368 0.372 0.355 wwwww 0.912 0.322 positive 0.900 joy for wwwwwwwwwww ############# wwwwwwwwwwww ############# www. 0 0.469 0.413 0.491 0.000 0.328 negative fear Oaza megan 0.421 www 0700 www X 1 Sun Mar 0 0.297 0.599 0.656 0.544 0.162 very negat fear 0 www 1.23E+18 #######&####### ##### 10 40 MEN BENERNE. 1.23E+18 #################### FE ***** wwwww www 2 Sat Feb 29 DE 0.349 DONO 0.581 0.572 0.552 0.V01 Care 0407 3 Fri Feb 28 1.23E+18 ################ 0.41 0.48 0.51 0.427 W₂ www 0:01 www wwwwww ##### ..................... A300 4 Wed Feb 2 1.23E+18 ###############&###### 0.523 0.443 0.337 0.303 www AZER www. KOK* 0.214 negative anger ADED ARE ung 0.258 negative fear 0.047 maiti iu 0.347 positive joy 0.224 poactive foar 0.234 negative fear 47 faar 0.17 negative fear 0.17 negative car 0.142 very negat anger 5 Fri Feb 28 0.455 0.356 0.45 0.354 1940 ME ************** wwwwww ................... 1.23E+18 ################### ###### #######* 1600 10 www.m 1.23E+18 ######⠀⠀⠀⠀⠀⠀⠀⠀⠀*###### 1.COLT 10 ###******* 0 F 20 www 0.000 www 0.004 6 Fri Feb 28 wwwww ##### 0.463 0.400 0.509 0.459 0:909 7 Carrel wwwww 7 Sat Feb 29 1.23E+18 ################### #######* 0.354 wwwwwwwwww ######## 0.239 wwwwwwww www ##### 0.621 0.554 viver 0.553 parlou 20 1.20 10 ********************* www www.m wwwww 8 Thu Feb 27 1.23E+18 ################### 0.349 0.532 0.526 0.496 ond Feb 2, 1.25E+10 ********************* 0.168 negative anger www Ve w.www wwwww 0.407 0.473 0.582 0.501 0:40 w.w0z 0.164 negative 1000 www. fear ann 10040 ZEN BEHERREN 1.23E+18 ###############&##### 0947 20 0.432 0.4 0.354 0.362 Fri Feb 28 Wed Feb 0.327 negative anger 0.492 wwwwwww 0.904 11 0.00€ www. 1 935 10. Deng 1 Wed Feb 2 0.351 0.544 0.62 0.136 negative fear 0.5 0.044 www ############# wwwwwwwww ############# wwwwwwwwwww ############# www. 9:02 19 www Feb 01 1 995 10 北 e foar 22 Sat Feb 01 1.23E+18 ###################### ####### ######## wwwwwww ...... #######* wwwwwww www. #### 0.384 0.525 0.547 0.5 2 paired of 1.220 0.004 vivew 0.263 negative fear 0.200 negative ww per 23 Tue *********** 1.22E+18 ################### 10 ********************* 1.22E+18 #######*#######*####### of 1.220 10 ***************wwwwww Feb 1 1.23E+18 #######*⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 0.327 #######* wwwwwwww 0.47 Feb 04 Tue Feb Mon 0.602 0.516 wwwwww 9:947 0.00€ 0:41 0.195 negative fear 0.190 negative 0:910 year wwwwwwwwwwwww 4 0.426 0.420 0.45 wwwwww 0.583 0.009 0.251 negative fear 1.401 0.40 * Monfred 11.2010. Tue 0.201 negative lear wwwwwwwwwwwww 25 Feb 25 1.23E+18 ###⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀##### ******** 0.451 wwwwwwwwww ####### www.www.ww #######* 0.5 0.342 0.492 0.386 to que rep 2 1.20 10 wwwwww wwwwww 0.042 0.492 0:900 0.375 neutral 19 0.0 0.57 no specific ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ wwwwwwwwww #### wwwwwwwwwwww m 0.312 0.294 26 Tue Feb 11 1.23E+18 #######⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀# wwwwwww 0.443 positive joy 7 Mon Feb 2 1.23E+18 #########⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 0.349 0.489 0.446 0.203 negative fear 0.287 negative fear 28 8 Sat Feb 29 1.23E+18 ########⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ 0.479 0.418 0.371 9 Thu Feb 21 1.23E+18 ############ 0.437 0.429 0.402 0.327 negative anger 30 Sun Mar 0 1.23E+18 0.313 0.626 0.571 0.309 negative anger 31 Thu Feb 27 1.23E+18 ############========= 0.336 0.563 0.472 0.258 negative fear covid sentiment metrics. Ⓒ 9 Fri Feb 28 1.23E+18 #######&#######&###### +18 #################### ##### TOASON www ##### ###### www ##### #### www ##### wwwww ##### ##### wwwwwww. wwwwwww. ######** wwwwwww ###### #######; ####### #######* ............... *####### #######; ######## #######* www ..... #######* 0.33 0.442 0.403 0.499 0.628 0.551 ############# ## ############# ############# ############# ................ www ############# www. ############# www. ############# wwwwwww ############# www ############# www. ############# ############# Q
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply