Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 2 out of 8 pages
Exam (elaborations)

DATA ANALYSIS WITH PYTHON TEST WITH CORRECT ANSWERS -2.

Document preview thumbnail
Preview 2 out of 8 pages

DATA ANALYSIS WITH PYTHON TEST WITH CORRECT ANSWERS -2.

Content preview

DATA ANALYSIS WITH PYTHON TEST WITH CORRECT
ANSWERS #2
Import numpy - correct answer import numpy as np

How to print out multiple stuff on one line - correct answer Use commas to separate the
printed statements

Print("Some string", a_variable)

How to print multiple stuff and then print out space beneath the printed statement -
correct answer Use '\n'

Print("One Dimensional Array", x1, '\n')

How to separate stuff from a printed statement into different paragraphs - correct
answer Use sep='\n'

Print("One Dimensional Array", x1, sep='\n')

Two dimensional array - correct answer my_array= np.array([[3,4,5,6],[4,5,6,-9]])

How to return the number of dimensions an array has - correct answer x1.ndim

Return the number of elements a in each dimension of an array - correct answer
x1.shape

Return the total number of elements across all dimensions of an array - correct answer
x1.size

How to tell the data types of elements in an array - correct answer float_array.dtype

Return every third element of an array - correct answer my_array[::3]

Return every other element, starting with the first element - correct answer
my_array[1::2]

How to reverse an array - correct answer numeric_array[::-1]

How to add value to dictionary - correct answer No brackets on other side

University_info['country'] = 'United States'
University_info

Function rule - correct answer Always return, don't print

, How to sort with numpy - correct answer np.sort()

For multidimensional arrays, specify axis
Np.sort(my_array, axis=0)

0 sorts columns, and 1 sorts rows

Nd_player_weights.sort() would sort the original values

How to split up array according to your specs - correct answer np.split(my_array,
[3,5,8])

Will split up values with indexes 0-2, then 3-4, then 5-7, then 8 beyond

How to split an array into equal parts - correct answer np.array_split(my_array, 6)
NO BRACKETS
Six arrays with equal parts. It returns a list with the specified number of arrays inside of
it

Np.hsplit() - correct answer split_1, split_2 = np.hsplit(employee_salaries_grid,
indices_or_sections=[3])
Print("First Split", split_1, sep='\n')
Print("Second Split", split_2, sep='\n')

OUT:
First Split
[[ 101442. 94122. 101592.]
[ 87006. 102228. 84054.]
[ 90024. 82614. 48078.]
[ 76266. 68616. 62820.]]
Second Split
[[ 110064. 50436. 103350. 93354. 84054.]
[ 91272. 111492. 95484. 114846. 63480.]
[ 72510. 48078. 110064. 110064. 42108.]
[ 128970. 48078. 89148. 101712. 70092.]]

Np.vsplit() - correct answer split_1, split_2, split_3 = np.vsplit(employee_salaries_grid,
[1, 3])

Print(split_1, split_2, split_3, sep='\n\n')

OUT:
[[ 101442. 94122. 101592. 110064. 50436. 103350. 93354. 84054.]]

[[ 87006. 102228. 84054. 91272. 111492. 95484. 114846. 63480.]
[ 90024. 82614. 48078. 72510. 48078. 110064. 110064. 42108.]]

Document information

Uploaded on
February 9, 2026
Number of pages
8
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$15.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
99
Followers
44
Items
5696
Last sold
2 months ago




Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions