SA3 Python Flashcards

1
Q

short for Numerical Python

A

Numpy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

is a foundational package for numerical computing in Python

A

Numpy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Why NumPy? (3)

A

Efficient calculations for large array of numbers
Computations on entire arrays without for loops
array-oriented computing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

To utilize the package, the initial step involves employing an import command

A

import numpy as np

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

To highlight one advantage of NumPy over traditional Python structures like lists, consider the scenario of performing ______

A

element-wise multiplication of two arrays of numbers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

a generic multidimensional container for homogeneous data

A

ndarray

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Array index starts at _ and increments by 1 in each succeeding position

A

0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

To create a NumPy array, you can use the function

A

np.array()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Import and declare numpy as np variable

A

import numpy as np

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create one-dimensional array using numpy and display the value of an array
x = np.array([2,4,6])
print (x)
output?

A

[2 4 6]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Create two-dimensional array using numpy and display the value of an array

x = np.array([[2,4,6],[2,4,6]])
print (x)
A

[[2 4 6]
[2 4 6]]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

It takes a _____ as input and produces a NumPy array containing the passed data

A

sequence

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

data = np.array([[1,2,3],[4,5,6]])
data

output?

A

array([[1, 2, 3],
[4, 5, 6]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Every array has:

A

shape
dtype
ndim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

tuple indicating size of each dimension

A

shape

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

data type of the array

A

dtype

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

number of dimensions

A

ndim

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

import numpy as np
data = np.array([[1,2,3],[4,5,6]])
data.shape
output?

A

(2, 3)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

import numpy as np
data = np.array([[1,2,3],[4,5,6]])
data.dtype
output?

A

dtype(‘int32’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

import numpy as np
data = np.array([[1,2,3],[4,5,6]])
data.ndim
output?

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

More ways to create arrays

A

np.zeros()
np.ones()
np.arange()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

x = np.array([2,4,6])
y = np.array([3,6,9])
z = x*y
print(z)
output?

A

[ 6 24 54]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

np.arange(7)
output?

A

array([0, 1, 2, 3, 4, 5, 6])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

np.zeros(5)
output?

A

array([0., 0., 0., 0., 0.])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

np.ones((2,4))
output?

A

array([[1., 1., 1., 1.],
[1., 1., 1., 1.]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

np.arange(1,20,2)
output?

A

array([1, 3, 5, 7, 9, 11, 13, 15, 17, 19])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Indexing in one-dimensional array is similar to lists or tuples

A

Array indexing and slicing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

Indexing in one-dimensional array is similar to ______

A

lists or tuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

data = np.array([1,2,3,4,5,6,7,8])
data[1]
output?

A

2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

data = np.array([1,2,3,4,5,6,7,8])
data[1:]
output?

A

array([2, 3, 4, 5, 6, 7, 8])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

data = np.array([1,2,3,4,5,6,7,8])
data[-1]
output?

A

8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

data = np.array([1,2,3,4,5,6,7,8])
data[[1,3,5,7]]

A

array([2, 4, 6, 8])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

However, in arrays, we can use a list of _____ inside square brackets

A

indices

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

data = np.array([[1,2,3],[4,5,6]])
data[0,:]
output?

A

array([[1, 2, 3],
[4, 5, 6]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

data = np.array([[1,2,3],[4,5,6]])
data[:,-1]
output?

A

array([3, 6])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

data[:,[0,2]]

A

array([[1, 3],
[4, 6]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

We also change ____ of an array to a single value

A

multiple values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

data = np.array([[1,2,3],[4,5,6]])
data[0,1] = 7
data
output?

A

array([[1, 7, 3],
[4, 5, 6]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

data = np.array([[1,2,3],[4,5,6]])
data[1,:] = 8
data
output?

A

array([[1, 7, 3],
[8, 8, 8]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

data = np.array([[1,2,3],[4,5,6]])
data[0,:2] = [9,10]
data
output?

A

array([[ 9, 10, 3],
[ 8, 8, 8]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

data = np.array([[1,2,3],[4,5,6]])
data[1,[0,2]] = [9,10]
data
output?

A

array([[ 9, 10, 3],
9, 8, 0]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

data1 = np.array([8.25, 3.26, 5.64])
data1 - 10
data1
output?

A

array([-1.75, -6.74, -4.36])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

data1 = np.array([8.25, 3.26, 5.64])
data1 * 2
data1
output?

A

array([16.5 , 6.52, 11.28])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

data1 = np.array([8.25, 3.26, 5.64])
data1 / 2
data1
output?

A

array([4.125, 1.63 , 2.82])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

data = np.array([[1,2,3], [4,5,6]])
data2 = np.array([[7,8,9],[10,11,7]])
data * data2

A

array([[ 7, 16, 27],
[40, 55, 42]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

data = np.array([[1,2,3], [4,5,6]])
data2 = np.array([[7,8,9],[10,11,7]])
data + data2

A

array([[ 8, 10, 12],
[14, 16, 13]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

data2 = np.array([[7,8,9],[10,11,7]])
data2 > 8

A

array([[False, False, True],
[ True, True, False]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

data = np.array([1,2,3], [4,5,6]])
data2 = np.array([[7,8,9],[10,11,7]])
data > data 2

A

array([[False, False, False],
[False, False, False]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

NumPy has many functions that can take arrays as _____.

A

input argument

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

The output is the ____ evaluated for every element of the input array

A

function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

data2 = np.array([[7,8,9],[10,11,7]])
np.sqrt(data2)

A

array([[2.64575131, 2.82842712, 3. ],
[3.16227766, 3.31662479, 2.64575131]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

data2 = np.array([[7,8,9],[10,11,7]])
np.round(np.sqrt(data2),2)

A

array([[2.65, 2.83, 3. ],
[3.16, 3.32, 2.65]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

data = np.array([1,2,3], [4,5,6]])
data2 = np.array([[7,8,9],[10,11,7]])
np.maximum(data, data2)

A

array([[ 7, 8, 9],
[10, 11, 7]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

Another attribute of an array is called T attribute. T stands for ____

A

transpose

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Another attribute of an array is called _ attribute.

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

data2 = np.array([[7,8,9],[10,11,7]])
data2.T

A

array([[ 7, 10],
[ 8, 11],
[ 9, 7]])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

Array methods that compute some descriptive statistics:

A

min()
max()
mean()
sum()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

data2 = np.array([[7,8,9],[10,11,7]])
data2.min()

A

7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

data2 = np.array([[7,8,9],[10,11,7]])
data2.sum()

A

52

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

data2 = np.array([[7,8,9],[10,11,7]])
data2.mean()

A

8.666666667

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

Just like lists, arrays are ____

A

mutable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

the method _____ on an array object will change the ordering of values in the original array

A

sort()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

data3 = np.array([2, 6, 4, 5, 10])
data3

A

array([ 2, 6, 4, 5, 10])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

data3 = np.array([2, 6, 4, 5, 10])
np.sort(data3)

A

array([ 2, 4, 5, 6, 10])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
65
Q

data = np.array([6,4,3,4,6,5])
data.sort()
data

A

array([3, 4, 4, 5, 6, 6])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
66
Q

Python can ____ of an array that satisfy a logical expression

A

index elements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
67
Q

data4 = np.array([1, 4, 2, 7, 6])
data4[data4 > 3]

A

array([4, 7, 6])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
68
Q

data4 = np.array([1, 4, 2, 7, 6])
data3 = np.array([2, 6, 4, 5, 10])
data4[data3 > 3] = 0
data4

A

array([1, 0, 0, 0, 0])

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
69
Q

Code is structured so that programming tasks are organized into so-called objects

A

Object-Oriented Programming (OOP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
70
Q

Code is structured so that programming tasks are organized into so-called ____

A

objects

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
71
Q

allows us to create our own data types

A

Object-Oriented Programming (OOP)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
72
Q

Better representation of real-world entity. We want our solutions to be designed around such type

A

Why create our own data types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
73
Q

Object have two main features:

A

Attributes (data/property)
Methods(functions/behaviors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
74
Q

data/property

A

Attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
75
Q

functions/behaviors

A

Methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
76
Q

blueprint to create objects

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
77
Q

class Person:
def __init__(self, name, age):
self.name = name
self.age = age

def introduce(self):
    print("Greetings, I'm" + self.name)

person1 = Person(“Juan dela Cruz”, 40)
person1.introduce()
print(person1.name)
print(person1.age)

A

Greetings, I’mJuan dela Cruz
Juan dela Cruz
40

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
78
Q

class Person:
def __init__(self, name, age):
self.name = name
self.age = age

def introduce(self):
    print("Greetings, I'm" + self.name)

person2 = Person(“Jhian Dale Sabonsolin”, 30)
person2.introduce()
print(person2.name)
print(person2.age)

A

Greetings, I’mJhian Dale Sabonsolin
Jhian Dale Sabonsolin
30

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
79
Q

class ClassName:
def __init__(self, parameter1, parameter2, …):
#define or assign object attributes

def other_methods(self, parameter1, parameter2, …):
#body of the method

A

Defining a Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
80
Q

a special method automatically run as soon as an object is instantiated

A

__init__()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
81
Q

Just like in strings and lists, we can also use _____ to determine the attributes and methods associated with a certain object

A

dot+TAB

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
82
Q

_____ attributes are attributes that are accessible across all the created instances

A

Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
83
Q

class Personv2:

n = 0

def \_\_init\_\_(self, name, age):
    self.name = name
    self.age = age
    Personv2.n += 1

def num_instances(self):
    print("we have", Personv2.n, "number of persons in total")

person1 = Personv2(“Tandang Sora”, 108)
person1.num_instance()
person2 = Personv2(“Maria CLara”, 20)
person2.num_instances()
person2.num_instances()

A

we have 1 number of persons in total
we have 2 number of persons in total
we have 2 number of persons in total

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
84
Q

Creation of a class that inherits all the methods and attributes of the another class

A

Inheritance

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
85
Q

___ extends available methods from Parent Class

A

Child Class

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
86
Q

class Personv2:
n = 0

def \_\_init\_\_(self,name,age):
    self.name = name
    self.age = age

    Personv2.n += 1

def introduce(self):
    print("Greetings, I'm " + self.name)
    print("I'm ", self.age, "years old")

def num_instances(self):
    print("We have", Personv2.n, "number of Persons in total.")

class Politician(Personv2):
def show_occupation(self):
print(“I’m a politician”)

politician1 = Politician(“Isko Moreno”, 46)
politician1.introduce()
politician1.show_occupation()

A

Greetings, I’m Isko Moreno
I’m 46 years old
I’m a politician

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
87
Q

Existing method in Parent class is implemented differently in Child Class

A

Method Overriding

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
88
Q

Child Class extends available methods from Parent Class

A

Extending New Method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
89
Q

class Personv2:
n = 0

def \_\_init\_\_(self,name,age):
    self.name = name
    self.age = age

    Personv2.n += 1

def introduce(self):
    print("Greetings, I'm " + self.name)
    print("I'm ", self.age, "years old")

def num_instances(self):
    print("We have", Personv2.n, "number of Persons in total.")

class Politician(Personv2):
def show_occupation(self):
print(“I’m a politician”)

class Senator(Politician):
def show_occupation(self):
print(“I’m “ + self.name)
print(“I’m a Senator”)

politician2 = Senator(“Grace Poe”, 53)
politician2.show_occupation()

A

I’m Grace Poe
I’m a Senator

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
90
Q

Processing of converting raw data into a usable form

A

Data Wrangling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
91
Q

Also called as data munging or data remediation

A

Data Wrangling

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
92
Q

Data Wrangling is also called as _______

A

data munging or data remediation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
93
Q

Data Wrangling steps:

A

Discovery
Transformation
Validation
Publishing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
94
Q

data examination for next step

A

Discovery

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
95
Q

data structuring, normalization & denormalization, data cleaning, data enriching

A

Transformation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
96
Q

4 elements of Transformation

A

data structuring, normalization & denormalization, data cleaning, data enriching

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
97
Q

verifying data consistency, sufficient quality, and secure

A

Validation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
98
Q

preferred format for sharing with teammates

A

Publishing

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
99
Q

Pandas library provides several functions for loading dataset

A

Loading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
100
Q

_____ provides several functions for loading dataset

A

Pandas library

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
101
Q

Dataset can be in any of ____ formats

A

supported

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
102
Q

Dataset can be in any of supported formats

A

Loading

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
103
Q

____ data structure holds input dataset

A

DataFrame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
104
Q

DataFrame data structure holds input dataset

A

Loading

105
Q

CSV meaning

A

Comma-Separated Values

106
Q

4 traits of CSV

A

Tabular Format
Text file with.csv file extension
very lightweight
may not be easy to read visually

107
Q

CSV to DataFrame

A

pandas.read_csv(‘’)

108
Q

import pandas as pd

dframe = pd.read_csv(‘module06-dataset-01.csv’)
dframe

A

shows csv

109
Q

import pandas as pd

dframe = pd.read_csv(‘module06-dataset-01.csv’, header=None)
dframe

A

shows csv without header

110
Q

Excluding headers:

A

header = None

111
Q

Specifying custom headers

A

names = []

112
Q

import pandas as pd

dframe = pd.read_csv(‘module06-dataset-01.csv’, names=[’ c0’ , ‘c1’ , ‘c2’ , ‘c3’ , ‘c4’])
dframe

A

shows csv with customized header names

113
Q

Sometimes, dataset can be large

A

Reading Text Files in Chunks

114
Q

Slow to load and display many rows at once

A

Reading Text Files in Chunks

115
Q

Partition dataset into chunks

A

Reading Text Files in Chunks

116
Q

Load and visualize only what is needed

A

Reading Text Files in Chunks

117
Q

Reading Text Files in Chunks traits

A

Sometimes, dataset can be large
Slow to load and display many rows at once

Partition dataset into chunks
Load and visualize only what is needed

118
Q

reads the text file into chunks

A

pandas.io.parsers.TextFileReader

119
Q

pandas.read_csv()
chunksize =

A

Specify size of chunks

120
Q

chunks = pd.read_csv(‘nz_2021_dataset.csv’, chunksize=4)
chunk = chunks.get_chunk()
chunk

A

reads csv in chunk

121
Q

chunks = pd.read_csv(‘nz_2021_dataset.csv’, chunksize=4)
chunk = chunks.get_chunk()
type(chunk)

A

pandas.core.frame.DataFrame

122
Q

chunks = pd.read_csv(‘nz_2021_dataset.csv’, chunksize=4)
chunk = chunks.get_chunk()
for chunk in chunks:
print (chunk)

A

print the data in each chunk

123
Q

Load and read Excel file:

A

pandas.io.excel._base.ExcelFile
pandas.ExcelFile(‘’)
pandas.read_excel(, ‘’)

124
Q

pandas.io.excel._base.ExcelFile

A

Load and read Excel file:

125
Q

pandas.ExcelFile(‘’)

A

Load and read Excel file:

126
Q

pandas.read_excel(, ‘’)

A

Load and read Excel file:

127
Q

xls_file = pd.ExcelFile(‘module06-dataset-03.xlsx’)
type(xls_file)

A

pandas.io.excel._base.ExcelFile

128
Q

dframe = pd.read_excel(xls_file, ‘Sheet1’)
type(dframe)

A

pandas.core.frame.DataFrame

129
Q

Directly read Excel file:

A

pandas.read_excel(‘’, ‘’)

130
Q

Prerequisite for data analysis

A

Data Cleaning and Preparation

131
Q

Datasets may have some gaps or redundancies

A

Data Cleaning and Preparation

132
Q

Some values may need to be filtered, filled in, or removed, or replaced

A

Data Cleaning and Preparation

133
Q

_____ provides several functions for loading data set

A

Pandas library

134
Q

Dataset may have missing or duplicate value sometimes

A

Cleaning Data with Pandas

135
Q

DataFrame object makes it easy for us to handle these kind of cases

A

Cleaning Data with Pandas

136
Q

_____ object makes it easy for us to handle these kind of cases

A

DataFrame

137
Q

Pandas library provides several functions for loading data set

A

Cleaning Data with Pandas

138
Q

_____ also provides convenience values for representing missing values

A

NumPy library

139
Q

NumPy library also provides convenience values for representing missing values

A

Cleaning Data with Pandas

140
Q

Missing data may occur due to several reasons:

A

Faulty recording device

Observer forgot to record

Data is not available at a particular time

141
Q

_____ can automatically identify and handle missing data in DataFrame objects

A

pandas

142
Q

NaN stands for

A

Not a Number

143
Q

NA stands for

A

Not Available

144
Q

Missing values for numeric data

A

numpy.nan

145
Q

Not Available for non-numeric data

A

numpy.nan

146
Q

Treated in pandas as Null object

A

numpy.nan

147
Q

import pandas as pd
import numpy as np

string_data = pd.Series([‘Tech’, ‘Alabang’, np.nan, ‘Diliman’])
string_data

A

0 Tech
1 Alabang
2 NaN
3 Diliman
dtype: object

148
Q

import pandas as pd
import numpy as np

string_data = pd.Series([‘Tech’, ‘Alabang’, np.nan, ‘Diliman’])
string_data.isnull()

A

0 False
1 False
2 True
3 False
dtype: bool

149
Q

import pandas as pd
import numpy as np

string_data = pd.Series([‘Tech’, ‘Alabang’, np.nan, ‘Diliman’])
string_data[0] = None
string_data.isnull()

A

0 True
1 False
2 True
3 False
dtype: bool

150
Q

function identifies NaN values in a pandas Series or DataFrame object

A

isnull()

151
Q

We may need to remove ____ values in our dataset

A

NaN

152
Q

Use ____ to identify NaN values and manually remove NaN elements from dataset

A

isnull()

153
Q

Use isnull() to identify NaN values and manually remove NaN elements from dataset

_____ function does the same task easier

A

dropna()

154
Q

import pandas as pd
from numpy import nan as NA

data = pd.Series([7, NA, 30.41, NA, 14])
data

A

0 7.00
1 NaN
2 30.41
3 NaN
4 14.00
dtype: float64

155
Q

import pandas as pd
from numpy import nan as NA

data = pd.Series([7, NA, 30.41, NA, 14])
filtered_data = data.dropna()
filtered_data

A

0 7.00
2 30.41
4 14.00
dtype: float64

156
Q

import pandas as pd
from numpy import nan as NA

data = pd.Series([7, NA, 30.41, NA, 14])
data.notnull()

A

0 True
1 False
2 True
3 False
4 True
dtype: bool

157
Q

import pandas as pd
from numpy import nan as NA

data = pd.Series([7, NA, 30.41, NA, 14])
data[data.notnull()]

A

0 7.00
2 30.41
4 14.00
dtype: float64

158
Q

import pandas as pd
from numpy import nan as NA

dframe = pd.DataFrame([[3.,4.8,9.],[5,NA,NA],[NA,NA,NA],[NA,2.7,4.]])
dframe

A

0 1 2
0 3.0 4.8 9.0
1 5.0 NaN NaN
2 NaN NaN NaN
3 NaN 2.7 4.0

159
Q

import pandas as pd
from numpy import nan as NA

dframe = pd.DataFrame([[3.,4.8,9.],[5,NA,NA],[NA,NA,NA],[NA,2.7,4.]])
dframe.dropna()

A

0 1 2
0 3.0 4.8 9.0

160
Q

import pandas as pd
from numpy import nan as NA

dframe = pd.DataFrame([[3.,4.8,9.],[5,NA,NA],[NA,NA,NA],[NA,2.7,4.]])
dframe.dropna(how=’all’)

A

0 1 2
0 3.0 4.8 9.0
1 5.0 NaN NaN
3 NaN 2.7 4.0

161
Q

import pandas as pd
from numpy import nan as NA

dframe = pd.DataFrame([[3.,4.8,9.],[5,NA,NA],[NA,NA,NA],[NA,2.7,4.]])
dframe.dropna(thresh=2)

A

0 1 2
0 3.0 4.8 9.0
3 NaN 2.7 4.0

162
Q

Sometimes our dataset is small

A

Filling in Missing Data

163
Q

It would be wasteful to drop missing values

A

Filling in Missing Data

164
Q

We can substitute some values to missing values instead

A

Filling in Missing Data

165
Q

import numpy as np
dframe = pd.DataFrame(np.random.randn(7,3))
dframe.iloc[:4,1] = NA
dframe.iloc[:2,2] = NA
dframe

A

0 1 2
0 -0.932532 NaN NaN
1 -0.873749 NaN NaN
2 1.135099 NaN -0.791733
3 -2.639708 NaN -0.861035
4 0.640254 0.742576 1.058761
5 0.721015 -1.292075 -2.970999
6 0.815502 0.680255 -0.189852

166
Q

import numpy as np
dframe = pd.DataFrame(np.random.randn(7,3))
dframe.iloc[:4,1] = NA
dframe.iloc[:2,2] = NA
dframe.fillna(0)

A

0 1 2
0 -0.425775 0.000000 0.000000
1 -0.438972 0.000000 0.000000
2 -0.535946 0.000000 -2.292911
3 0.245555 0.000000 -1.208168
4 0.234962 -1.431170 0.485830
5 1.557753 -0.217653 -0.755951
6 0.881526 0.522738 0.238875

167
Q

import numpy as np
dframe = pd.DataFrame(np.random.randn(7,3))
dframe.iloc[:4,1] = NA
dframe.iloc[:2,2] = NA
dframe.fillna(method=’ffill’, limit=2)

A

0 1 2
0 -1.164232 NaN NaN
1 -0.757661 NaN NaN
2 -3.202468 NaN -0.578659
3 -0.079353 NaN -0.256618
4 -0.847801 -2.348468 1.158686
5 -0.303926 -1.305736 1.306776
6 -0.788499 -0.825362 0.647539

168
Q

import numpy as np
dframe = pd.DataFrame(np.random.randn(7,3))
dframe.iloc[:4,1] = NA
dframe.iloc[:2,2] = NA
dframe.fillna(dframe.mean())

A

0 1 2
0 0.145152 1.012872 -0.242515
1 -0.416277 1.012872 -0.242515
2 0.853098 1.012872 -0.498046
3 0.543091 1.012872 -2.265999
4 0.108736 2.854558 0.759443
5 2.153837 -0.685959 1.045881
6 0.584637 0.870018 -0.253854

169
Q

dframe = pd.DataFrame({‘column1’: [‘BSCS-SE’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,], ‘column2’: [1,1,2,3,3,4,4]})
dframe

A

column1 column2
0 BSCS-SE 1
1 BSCS-DS 1
2 BSCS-SE 2
3 BSCS-DS 3
4 BSCS-DS 3
5 BSCS-SE 4
6 BSCS-DS 4

170
Q

dframe = pd.DataFrame({‘column1’: [‘BSCS-SE’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,], ‘column2’: [1,1,2,3,3,4,4]})
dframe.drop_duplicates()

A

column1 column2
0 BSCS-SE 1
1 BSCS-DS 1
2 BSCS-SE 2
3 BSCS-DS 3
5 BSCS-SE 4
6 BSCS-DS 4

171
Q

dframe = pd.DataFrame({‘column1’: [‘BSCS-SE’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,], ‘column2’: [1,1,2,3,3,4,4]})
dframe.duplicated()

A

0 False
1 False
2 False
3 False
4 True
5 False
6 False
dtype: bool

172
Q

dframe = pd.DataFrame({‘column1’: [‘BSCS-SE’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,’BSCS-DS’,’BSCS-SE’,’BSCS-DS’,], ‘column2’: [1,1,2,3,3,4,4]})
dframe.drop_duplicates([‘column1’])

A

column1 column2
0 BSCS-SE 1
1 BSCS-DS 1

173
Q

data = pd.Series([0,89.4556, -1, 97.0274, 0, -5])
data

A

0 0.0000
1 89.4556
2 -1.0000
3 97.0274
4 0.0000
5 -5.0000
dtype: float64

174
Q

data = pd.Series([0,89.4556, -1, 97.0274, 0, -5])
data.replace(-1,np.nan)

A

0 0.0000
1 89.4556
2 NaN
3 97.0274
4 0.0000
5 -5.0000
dtype: float64

175
Q

data = pd.Series([0,89.4556, -1, 97.0274, 0, -5])
data.replace(-1,np.nan, inplace=True)
data

A

0 0.0000
1 89.4556
2 NaN
3 97.0274
4 0.0000
5 -5.0000
dtype: float64

176
Q

data = pd.Series([0,89.4556, -1, 97.0274, 0, -5])
data.replace([0,-1],np.nan)

A

0 NaN
1 89.4556
2 NaN
3 97.0274
4 NaN
5 -5.0000
dtype: float64

177
Q

data = pd.Series([0,89.4556, -1, 97.0274, 0, -5])
data.replace([0,-1],[99,-99])

A

0 99.0000
1 89.4556
2 -99.0000
3 97.0274
4 99.0000
5 -5.0000
dtype: float64

178
Q

It is common to encounter ____ in a dataset

A

missing values

179
Q

Missing values in a dataset may result from______, _______, or _____ at some particular time

A

faulty or unavailable measuring device
lapse of the observer
unavailability of data

180
Q

pandas uses NumPy’s ____ to indicate missing values

A

nan value

181
Q

pandas provides the ____, _____, the ______ function and their variants to manage missing values in datasets

A

fillna()
dropna()
replace()

182
Q

Some data may be stored in text files, while others may need to be accessed from relational databases

A

Merging Datasets

183
Q

Loading and reading from separate sources requires multiple data objects to organize

A

Merging Datasets

184
Q

This entails merging these datasets into single dataset to perform further operations

A

Merging Datasets

185
Q

Pandas library provides functionalities for combining objects together:

A

pandas.merge
DataFrame.join

186
Q

appends rows in a DataFrame object based on keys of DataFrame

A

pandas.merge

187
Q

joins another DataFrame instance to the calling DataFrame

A

DataFrame.join

188
Q

import pandas as pd
dframe1 = pd.DataFrame({‘key’: [‘BSCS-DS’, ‘BSCS-DS’, ‘BSCS-SE’, ‘BSIT-AGD’, ‘BSCS-SE’, ‘BSCS-SE’, ‘BSCS-DS’], ‘data_left’: range(7)})

dframe2 = pd.DataFrame({‘key’: [‘BSCS-SE’, ‘BSCS-DS’, ‘BSIT-BA’], ‘data_right’: range(3)})

dframe1

A

key data_left
0 BSCS-DS 0
1 BSCS-DS 1
2 BSCS-SE 2
3 BSIT-AGD 3
4 BSCS-SE 4
5 BSCS-SE 5
6 BSCS-DS 6

189
Q

import pandas as pd
dframe1 = pd.DataFrame({‘key’: [‘BSCS-DS’, ‘BSCS-DS’, ‘BSCS-SE’, ‘BSIT-AGD’, ‘BSCS-SE’, ‘BSCS-SE’, ‘BSCS-DS’], ‘data_left’: range(7)})

dframe2 = pd.DataFrame({‘key’: [‘BSCS-SE’, ‘BSCS-DS’, ‘BSIT-BA’], ‘data_right’: range(3)})

dframe2

A

key data_right
0 BSCS-SE 0
1 BSCS-DS 1
2 BSIT-BA 2

190
Q

Merging DataFrames can be done by passing them into the _____.

A

pandas.merge()

191
Q

import pandas as pd
dframe1 = pd.DataFrame({‘key’: [‘BSCS-DS’, ‘BSCS-DS’, ‘BSCS-SE’, ‘BSIT-AGD’, ‘BSCS-SE’, ‘BSCS-SE’, ‘BSCS-DS’], ‘data_left’: range(7)})

dframe2 = pd.DataFrame({‘key’: [‘BSCS-SE’, ‘BSCS-DS’, ‘BSIT-BA’], ‘data_right’: range(3)})

pd.merge(dframe1, dframe2)

A

key data_left data_right
0 BSCS-DS 0 1
1 BSCS-DS 1 1
2 BSCS-DS 6 1
3 BSCS-SE 2 0
4 BSCS-SE 4 0
5 BSCS-SE 5 0

192
Q

import pandas as pd
dframe1 = pd.DataFrame({‘key’: [‘BSCS-DS’, ‘BSCS-DS’, ‘BSCS-SE’, ‘BSIT-AGD’, ‘BSCS-SE’, ‘BSCS-SE’, ‘BSCS-DS’], ‘data_left’: range(7)})

dframe2 = pd.DataFrame({‘key’: [‘BSCS-SE’, ‘BSCS-DS’, ‘BSIT-BA’], ‘data_right’: range(3)})

pd.merge(dframe1, dframe2, on=’key’)

A

key data_left data_right
0 BSCS-DS 0 1
1 BSCS-DS 1 1
2 BSCS-DS 6 1
3 BSCS-SE 2 0
4 BSCS-SE 4 0
5 BSCS-SE 5 0

193
Q

Pandas automatically determined the column on which to merge the 2 datasets: _____

A

key

194
Q

Performing merging DataFrames by specifying the ____

A

left and right keys

195
Q

The common key values ____ in the merged DataFrame

A

remained

196
Q

Only the _____ are merged into resulting dataset

A

intersection of the key values

197
Q

import pandas as pd
dframe3 = pd.DataFrame({‘key_left’: [‘BSCS-DS’,’BSCS-DS’, ‘BSCS-SE’, ‘BSIT-WMA’, ‘BSCS-SE’, ‘BSCS-SE’, ‘BSCS-DS’], ‘data_left’: range(7)})

dframe4 = pd.DataFrame({‘key_right’: [‘BSCS-SE’, ‘BSCS-DS’, ‘BSIT-AGD’], ‘data_right’: range(3)})

pd.merge(dframe3, dframe4, left_on=’key_left’, right_on=’key_right’)

A

key_left data_left key_right data_right
0 BSCS-DS 0 BSCS-DS 1
1 BSCS-DS 1 BSCS-DS 1
2 BSCS-DS 6 BSCS-DS 1
3 BSCS-SE 2 BSCS-SE 0
4 BSCS-SE 4 BSCS-SE 0
5 BSCS-SE 5 BSCS-SE 0

198
Q

Union of the input datasets requires specifying the outer merge operation using ____ parameter in the merge() function

A

how

199
Q

import pandas as pd
dframe1 = pd.DataFrame({‘key’: [‘BSCS-DS’, ‘BSCS-DS’, ‘BSCS-SE’, ‘BSIT-AGD’, ‘BSCS-SE’, ‘BSCS-SE’, ‘BSCS-DS’], ‘data_left’: range(7)})

dframe2 = pd.DataFrame({‘key’: [‘BSCS-SE’, ‘BSCS-DS’, ‘BSIT-BA’], ‘data_right’: range(3)})

pd.merge(dframe1, dframe2, on=’key’, how=’outer’)

A

key data_left data_right
0 BSCS-DS 0.0 1.0
1 BSCS-DS 1.0 1.0
2 BSCS-DS 6.0 1.0
3 BSCS-SE 2.0 0.0
4 BSCS-SE 4.0 0.0
5 BSCS-SE 5.0 0.0
6 BSIT-AGD 3.0 NaN
7 BSIT-BA NaN 2.0

200
Q

means the keys in both left and right datasets are assigned with multiple values

A

Many-to-Many Join

201
Q

The operations takes all possible combinations of keys and values from the input Dataframes

A

M:N

202
Q

Here, the combination of rows were considered based on the rows of the left dataset

A

Many-to-Many Join

203
Q

dframe5 = pd.DataFrame({‘key’: [‘b’,’b’,’a’,’c’,’a’,’b’], ‘data_left’: range(6)})
dframe6 = pd.DataFrame({‘key’: [‘a’,’b’,’a’,’b’,’d’], ‘data_right’: range(5)})

pd.merge(dframe5, dframe6, on=’key’, how=’left’)

A

key data_left data_right
0 b 0 1.0
1 b 0 3.0
2 b 1 1.0
3 b 1 3.0
4 a 2 0.0
5 a 2 2.0
6 c 3 NaN
7 a 4 0.0
8 a 4 2.0
9 b 5 1.0
10 b 5 3.0

204
Q

To merge datasets by considering their intersection of the rows:

Add in the parameter an inner merge:

A

how = ‘inner’

205
Q

dframe5 = pd.DataFrame({‘key’: [‘b’,’b’,’a’,’c’,’a’,’b’], ‘data_left’: range(6)})
dframe6 = pd.DataFrame({‘key’: [‘a’,’b’,’a’,’b’,’d’], ‘data_right’: range(5)})

pd.merge(dframe5, dframe6, how=’inner’)

A

key data_left data_right
0 b 0 1
1 b 0 3
2 b 1 1
3 b 1 3
4 b 5 1
5 b 5 3
6 a 2 0
7 a 2 2
8 a 4 0
9 a 4 2

206
Q

At times, the index of the DataFrame also serves as its key

A

Merging on Index

207
Q

At times, the ____ of the DataFrame also serves as its key

A

index

208
Q

dframe8 = pd.DataFrame({‘group_val’: [2.5, 4.0]}, index=[‘CCS0001’, ‘CCS0003’])
dframe8

A

group_val
CCS0001 2.5
CCS0003 4.0

209
Q

dframe7 = pd.DataFrame({‘key’: [‘CCS0001’, ‘CCS0003’, ‘CCS0001’, ‘CCS0001’, ‘CCS0003’, ‘CCS0007’], ‘data_left’ : range(6)})
dframe8 = pd.DataFrame({‘group_val’: [2.5, 4.0]}, index=[‘CCS0001’, ‘CCS0003’])
pd.merge(dframe7, dframe8, left_on=’key’, right_index=True)

A

key data_left group_val
0 CCS0001 0 2.5
2 CCS0001 2 2.5
3 CCS0001 3 2.5
1 CCS0003 1 4.0
4 CCS0003 4 4.0

210
Q

The ______ specifies whether we want to use the index of right DataFrame as the column on which we want to merge with left DataFrame

A

right_index

211
Q

By default, _____ is an inner merge operation and it excludes the rows in the left dataset with keys that are not common with the index of right dataset

A

merge in pandas

212
Q

dframe7 = pd.DataFrame({‘key’: [‘CCS0001’, ‘CCS0003’, ‘CCS0001’, ‘CCS0001’, ‘CCS0003’, ‘CCS0007’], ‘data_left’ : range(6)})
dframe8 = pd.DataFrame({‘group_val’: [2.5, 4.0]}, index=[‘CCS0001’, ‘CCS0003’])
pd.merge(dframe7, dframe8, left_on=’key’, right_index=True, how=’outer’)

A

key data_left group_val
0 CCS0001 0 2.5
2 CCS0001 2 2.5
3 CCS0001 3 2.5
1 CCS0003 1 4.0
4 CCS0003 4 4.0
5 CCS0007 5 NaN

213
Q

The ____ method is used for merging with another Dataframe by index.

A

join

214
Q

Useful for joining DataFrames with similar indices but not non-overlapping columns

A

join

215
Q

dframe9 = pd.DataFrame([[1,2],[3,4],[5,6]], index=[‘Student1’,’Student3’,’Student5’], columns=[‘SA1’, ‘SA2’])

dframe10 = pd.DataFrame([[7,8],[9,10],[11,12],[13,14]], index = [‘Student2’,’Student3’,’Student4’,’Student5’], columns=[‘TA1’, ‘TA2’])

dframe9.join(dframe10, how=’inner’)

A

SA1 SA2 TA1 TA2
Student3 3 4 9 10
Student5 5 6 13 14

216
Q

dframe9 = pd.DataFrame([[1,2],[3,4],[5,6]], index=[‘Student1’,’Student3’,’Student5’], columns=[‘SA1’, ‘SA2’])

dframe10 = pd.DataFrame([[7,8],[9,10],[11,12],[13,14]], index = [‘Student2’,’Student3’,’Student4’,’Student5’], columns=[‘TA1’, ‘TA2’])

dframe9.join(dframe10, how=’outer’)

A

SA1 SA2 TA1 TA2
Student1 1.0 2.0 NaN NaN
Student2 NaN NaN 7.0 8.0
Student3 3.0 4.0 9.0 10.0
Student4 NaN NaN 11.0 12.0
Student5 5.0 6.0 13.0 14.0

217
Q

dframe9 = pd.DataFrame([[1,2],[3,4],[5,6]], index=[‘Student1’,’Student3’,’Student5’], columns=[‘SA1’, ‘SA2’])

dframe10 = pd.DataFrame([[7,8],[9,10],[11,12],[13,14]], index = [‘Student2’,’Student3’,’Student4’,’Student5’], columns=[‘TA1’, ‘TA2’])

dframe9.join(dframe10, how=’left’)

A

SA1 SA2 TA1 TA2
Student1 1 2 NaN NaN
Student3 3 4 9.0 10.0
Student5 5 6 13.0 14.0

218
Q

Which of the following is not a characteristic of object-oriented programming?
Group of answer choices

Imperative programming

Declarative programming

Functional programming

Procedural programming

A

Procedural programming

219
Q

How is indexing performed in a one-dimensional NumPy array?

A

Using square brackets []

220
Q

What is the common alias used for importing NumPy in Python?
Group of answer choices

import numpy as np

import num

import numeric as np

from numpy import np

A

import numpy as np

221
Q

What does the ‘T’ attribute represent in NumPy arrays?
Group of answer choices

Tuple indicating the size of each dimension

Transpose of the array

Type of the array

Total number of elements

A

Transpose of the array

222
Q

What is the concept where the derived class acquires the attributes of its base class.
Group of answer choices

object

class

inheritance

none of the above

A

inheritance

223
Q

What is abstraction in object-oriented programming?
Group of answer choices

Revealing the complex implementation details of an object

Hiding the complex implementation details and showing only the necessary features of an object.

Showing all the implementation details of an object

Only displaying the unnecessary features of an object

A

Hiding the complex implementation details and showing only the necessary features of an object.

224
Q

How are mathematical operations typically performed on arrays in NumPy?
Group of answer choices

Using a loop to iterate through each element

By converting arrays to lists and performing operations

Element-wise operations using specific NumPy functions

Using traditional Python operators like +, -, *, /

A

Using traditional Python operators like +, -, *, /

225
Q

What happens when the sort() method is called on a NumPy array?
Group of answer choices

It rearranges the array elements in ascending order.

It converts the array to a sorted list.

It throws an error since NumPy arrays cannot be sorted.

It returns the maximum element of the array.

A

It rearranges the array elements in ascending order.

226
Q

Which is an example of creating an object in Python using a class?
Group of answer choices

x = ClassName.createObject()

x = ClassName.create_object()

x = ClassName()

x = object.ClassName()

A

x = object.ClassName()

227
Q

Which method is used to compute the total of elements in a NumPy array?
Group of answer choices

total()

sum()

add()

accumulate()

A

sum()

228
Q

What is the significance of the self parameter in class methods?
Group of answer choices

its a keyword for creating instances

its used to denote private methods

it point to the current object being operated on

it refers to the class itself

A

it point to the current object being operated on

229
Q

Which keyword is used to define a class in Python?
Group of answer choices

def

if

class

for

A

class

230
Q

How does NumPy handle element-wise multiplication of arrays compared to Python lists?
Group of answer choices

Both NumPy and Python lists use the * operator.

NumPy provides a more efficient solution using the * operator.

NumPy requires a specific function call, while Python lists use the * operator.

NumPy uses the * operator, while Python lists use the multiply() method.

A

NumPy provides a more efficient solution using the * operator.

231
Q

What does an object consist of?
Group of answer choices

procedures

intergers

methods

variables

A

methods

232
Q

Which attribute indicates the number of dimensions in a NumPy array?
Group of answer choices

size

ndim

dtype

shape

A

ndim

233
Q

What is an example of an object using a method in Python?
Group of answer choices

print(“Hello, World!”)

animals.Tiger()

import math

list.append()

A

animals.Tiger()

234
Q

Which of the following statements correctly creates an instance of a class name vehicle in Python?
Group of answer choices

new_vehicle=vehicle()

class vehicle:new_vehicle = vehicle()

Vehicle new_vehiicle = Vehicle()

new_vehicle = vehicle()

A

new_vehicle = vehicle()

235
Q

What are the special methods that can be used to create and initialize an object?
Group of answer choices

objects

interfaces

constructors

classes

A

constructors

236
Q

Process of representing data in a visual and meaningful way

A

Information Visualization

237
Q

Used by Data Analyst to easily describe and communicate patterns that exist from raw data extracts

A

Information Visualization

238
Q

is a python package that is used in making informative visualizations or plots

A

matplotlib

239
Q

It has a vast number of ways to visualize:

Lines, bars, and markers
Images, contours and fields
Subplots, axes, and figures
Statistics
Pie and polar charts
Text, labels and annotations
Stylesheets
Spines

A

matplotlib

240
Q

Using matplot requires an import command for matplotlib

A

import matplotlib.pyplot as plt
%%matplotlib notebook
import numpy as np

241
Q

In Jupyter notebook, figures produced by ___ are shown directly within the notebook and with the magic command %____ notebook, interactive operations like panning, zooming in/out and so on can be done with the produced figures

A

matplotlib

242
Q

These command ____ creates points by matching a number in x with its corresponding number in y

A

plt.plot(x, y)

243
Q

The command plt.plot() accepts a ____ that allows user to customize the appearance of the plot

A

third string input

244
Q

To create a title for a given figure, we can use
_____

A

plt.title()

245
Q

Aside from getting a string argument for titles and names, we can also specify the font size of the titles and names by including ____

A

fontsize = number

246
Q

To change the size of a figure, we can create a figure object and resize it. Every time we call ____ function, we create a new figure object and draw on it

A

plt.figure()

247
Q

To get a list of this styles, we can type in the following command: ____

A

plt.style.available

248
Q

To use the style, we use the command ____ then we pass our chosen style as argument

A

plt.style.use()

249
Q

To recover matplotlib defaults after setting stylesheet, we can use the command:

\_\_\_
A

plt.style.use(‘default’)

250
Q

First, we put a label to each of our plot. This means, we will have to pass a label argument (i.e.
_______) to the plot function

A

label =”label name”

251
Q

We then use the command ____. The label passed in the plot functions will be used in the creation of a legend

A

plt.legend()

252
Q

An additional argument that we can use for plt.legend() is ____ which represents location

A

loc

253
Q

Changing upper and lower bound of the x-axis and the y-axis. Set new upper and lower bounds using ______

A

plt.xlim() and plt.ylim()

254
Q

Additionally, we can draw a grid via ____so that we can further see the values of points in the plot

A

plt.grid()

255
Q

Modifying number of tick marks: Use _____ and modify its axis and ____ parameter

A

plt.locator_params(), nbins

256
Q

In the parameter _____: Indicate the number of tick marks that we want in our specified axis. Python will then automatically compute for the steps (and the corresponding tick mark values) given the number of bins

A

nbins (number of bins)

257
Q

The ____ allows to include multiple plot graphs in one figure

A

library matplotlib

258
Q

The subplot() function uses three inputs:

A

(a) the number of rows of plots,
(b) the number of columns on plots, and
(c) plot location

259
Q

Use _____ to ensure that the created subfigures do not overlap

A

plt.tight_layout()