0% found this document useful (0 votes)
16 views

Data Analysis With Python Quiz 2

nixe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Data Analysis With Python Quiz 2

nixe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Python for Data Science Quiz 2

Q No: 1
Marks: 2/2

For the given array, demo_array=np.arange(0,10)


Choose the right option if you run the following codes one after another.

demo_array
demo_array <3
demo_array[demo_array <6]
np.max(demo_array)

 array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
 array([True, True, True, False, False, False, False, False, False, False ])
 array([0, 1, 2, 3, 4, 5])
 10

 array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 array([True, True, True, False, False, False, False, False, False, False ])
 array([1, 2, 3, 4, 5])
 9

 array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 array([True, True, True, True, False, False, False, False, False, False ])
 array([0, 1, 2, 3, 4])
 9

 array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
 array([True, True, True, False, False, False, False, False, False, False ])
 array([0, 1, 2, 3, 4, 5])
 9

Q No: 2
Marks: 2/2

For the given matrix,


demo_matrix = np.array(([13,35,74,48], [23,37,37,38],[73,39,93,39]))
What is the output of the following line?
demo_matrix[:, (1,2)]
o array([[13, 35],
[23, 37],
[73, 39]])

This study source was downloaded by 100000888762090 from CourseHero.com on 08-12-2024 05:24:22 GMT -05:00

https://www.coursehero.com/file/131169176/Python-for-Data-Science-Quiz-2docx/
o array([[35, 74],
[37, 37],
[39, 93]])
o array([[23,74],
[37, 37]])
o array([[13, 23]])

Q No: 3
Marks: 2/2

For the given matrix,


demo_array = np.arange(10,21)
What is the output of the following lines?
subset_demo_array = demo_array[0:7]
subset_demo_array[:]= 101
subset_demo_array

o array = ([101])
o array = ([101, 101, 101, 101, 101, 101, 101])
o array = (101)
o array = [(101, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20)]

Q No: 4
Marks: 2/2

How do we import an excel file to Jupyter Notebook from external sources?

o pd.read_excel("filename")
o read_excel("filename")
o pd.load("filename")
o pd.excel("filename")

This study source was downloaded by 100000888762090 from CourseHero.com on 08-12-2024 05:24:22 GMT -05:00

https://www.coursehero.com/file/131169176/Python-for-Data-Science-Quiz-2docx/
Q No: 5
Marks: 2/2

If Dataframe =

word1 word2 word3 word4 word5


l 1.62435 -0.6118 -0.5282 -1.073 0.86541
m -2.3015 1.74481 -0.7612 0.31904 -0.2494
n 1.46211 -2.0601 -0.3224 -0.3841 1.13377
o -1.0999 -0.1724 -0.8779 0.04221 0.58282
p -1.1006 1.14472 0.90159 0.50249 0.90086

which of the following will give the below output?


Alphabe
word1 word2 word3 word4 word5
ts
l 1.62435 -0.6118 -0.5282 -1.073 0.86541 A
m -2.3015 1.74481 -0.7612 0.31904 -0.2494 B
n 1.46211 -2.0601 -0.3224 -0.3841 1.13377 C
o -1.0999 -0.1724 -0.8779 0.04221 0.58282 D
p -1.1006 1.14472 0.90159 0.50249 0.90086 E

o newcolumn = ["A", "B", "C", "D", "E"]

o newcolumn = ["A", "B", "C", "D", "E"] dataframe['Alphabets'] =


newcolumn
o newcolumn = ["A", "B", "C", "D", "E"] np.DataFrame('Alphabets') =
newcolumn
o newcolumn = ["A", "B", "C", "D", "E"] dataframe['Alphabets']

This study source was downloaded by 100000888762090 from CourseHero.com on 08-12-2024 05:24:22 GMT -05:00

https://www.coursehero.com/file/131169176/Python-for-Data-Science-Quiz-2docx/
Powered by TCPDF (www.tcpdf.org)

You might also like