Summer 2022 Final Exam

pdf

School

University of California, San Diego *

*We aren’t endorsed by this school

Course

10

Subject

Mathematics

Date

Feb 20, 2024

Type

pdf

Pages

20

Uploaded by BaronJackal4036

Report
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 1/20 df df str 'kind' (str) 'size' (str) 'longevity' (float) 'price' (float) 'kids' (int) 1 2 3 'weight' (float) 'height' (float) df df df import babypandas as bpd import numpy as np df
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 2/20 'size'
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 3/20 df[__(a)__].__(b)__.__(c)__
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 4/20 loc[0] iloc[0] index[0] min() foo = df.__(a)__.__(b)__ np.array(foo[__(c)__].__d__)
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 5/20 .index .unique() .get('kind') .get(['kind']) reset_index() .index .unique() .get('kind') .get(['kind']) sums sums >>> sums(np.array([ 1 , 2 , 3 , 4 , 5 ])) array([ 1 , 3 , 6 , 10 , 15 ]) >>> sums(np.array([ 100 , 1 , 1 ])) array([ 100 , 101 , 102 ])
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 6/20 doggos 'longevity' def sums(arr): res = _________ (a) res = np.append(res, arr[ 0 ]) for i in _________: (b) res = np.append(res, _________) (c) return res def doggos(n, lower, upper): t = df.sample(n, replace = True ).get( 'longevity' ) return sum(lower <= t < upper)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 7/20 doggos(1, 10, 11) == 1 True doggos(2, 0, 12) == 2 True doggos(2, 13, 20) > 0 True
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 8/20
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 9/20 stat a = np.random.choice([ 0.3 , 0.7 ]) b = np.random.choice([ 0.3 , 0.7 ]) stat = a - b a = np.random.choice([ 0.1 , 0.2 , 0.3 , 0.2 , 0.15 , 0.05 ]) stat = a - ( 1 - a)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 10/20 sim obs < <= == >= > a = np.random.multinomial( 500 , [ 0.1 , 0.2 , 0.3 , 0.2 , 0.15 , 0.05 ]) / 500 stat = a[ 2 ] - ( 1 - a[ 2 ]) a = np.random.multinomial( 500 , [ 0.3 , 0.7 ]) / 500 stat = a[ 0 ] - ( 1 - a[ 0 ]) a = df.sample( 500 , replace = True ) b = a[a.get( "kind" ) == "toy" ].shape[ 0 ] / 500 stat = b - ( 1 - b) np.mean(sim _______ obs)
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 11/20
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 12/20 oren boots a = np.mean(oren) b = np.std(oren) c = len(oren)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 13/20 b b / c b / np.sqrt(c) b * np.sqrt(c) boots a (oren - a).mean() (oren - a) / b boots b b / c b / np.sqrt(c) (a -b) / np.sqrt(c)
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 14/20 (560 - a) / b (560 - a) / (b / np.sqrt(c)) (a - 560) / (b / np.sqrt(c))} abs(560 - a) / b abs(560 - a) / (b / np.sqrt(c)) boots boots boots 2 2 2
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 15/20 stats.norm.cdf( 1.75 ) # => 0.96 stats.norm.cdf( 1.4 ) # => 0.92
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 16/20 r x = df.get( 'weight' ) y = df.get( 'height' ) def su(vals): return (vals - vals.mean()) / np.std(vals) r = (su(x) * su(y)).mean() r = su(x * y).mean() t = 0 for i in range(len(x)): t = t + su(x[i]) * su(y[i]) r = t / len(x) t = np.array([]) for i in range(len(x)): t = np.append(t, su(x)[i] * su(y)[i]) r = t.mean()
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 17/20
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 18/20 df.groupby("kind").mean()
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 19/20 stats stats
24. 2. 12. 오후 9:13 Summer 2022 Final Exam https://practice.dsc10.com/su22-final/index.html 20/20