37 Questions
What is the primary purpose of a software library in Python?
To provide a collection of pre-written code
What are the two ways to import a Python library?
Importing the whole library with an alias or importing a specific function
What is the primary use of the NumPy library in Python?
For creating and manipulating N-dimensional arrays
What is the purpose of the np.reshape function in NumPy?
To transform a 1D array into a multidimensional array
What is the dimension of a 2D NumPy array?
Array of Arrays
What will happen if you try to reshape a 12-element 1D array into a 4x4 2D array?
It will generate an error
What is the method to display the first and last 5 rows of a DataFrame?
myDataFrame.head()
How can you create a DataFrame from a csv file?
myDataFrame = pd.read_csv('myfile.csv')
What is the attribute of an Iris flower characterized by the length in centimeters?
sepal_length
How can you save a DataFrame to a csv file?
myDataFrame.to_csv('myOutputFile.csv')
How many Iris species are in the Iris sample data?
3
What is the main library used for dealing with numeric and string data?
Pandas
What is the purpose of the 'describe' function in Pandas Series?
To provide a full numerical summary of the series
What is the default name of the first column in a Pandas Series?
Index
How can you access a value in a Pandas Series using a custom index?
Using square brackets with the custom index value
What is the purpose of the 'read_csv' function in Pandas?
To read data from a CSV file into a DataFrame
What is a Pandas DataFrame?
A 2D collection of data with custom indices and headers
What is the purpose of the np.transpose function in NumPy?
To replace rows with columns in a 2D array
What is the output of np.sort(arr_2D,axis=1)?
Row-wise sorted array
What does np.sum(grades,axis=1) calculate?
The sum of each row in the array
What does grades[0,0] access in the array?
The element at the first row and first column
What does grades[0:2] access in the array?
The first and second rows
What does grades[:,0] access in the array?
The entire first column
What does grades[:,-1] access in the array?
The entire last column
What is the purpose of the reshape function in NumPy?
To convert a 1D array to a 2D array
What is the output of np.min(grades,axis=1)?
The minimum of each row
What is the main difference between NumPy arrays and Pandas Series/DataFrames?
NumPy arrays are optimized for homogenous numeric data, while Pandas supports heterogeneous data
In DataFrames, which statistics are calculated by column?
Only for numeric columns
What is the purpose of the describe()
function?
To calculate statistics for numeric columns
How can you calculate the mean of a DataFrame?
Using the mean()
function
What is the output of data.to_numpy()
?
A NumPy array
How can you convert a NumPy array into a DataFrame?
Using the pd.DataFrame()
constructor
What is the purpose of the iloc[]
function?
To select rows and columns in a DataFrame
What is the output of data.iloc[:, 0:4].to_numpy()
?
A NumPy array with the first 4 columns
What is the purpose of the head()
function?
To display the first few rows of a DataFrame
How can you add columns to a DataFrame?
Using the columns=[]
argument
What is the purpose of the std()
function?
To calculate the standard deviation of a DataFrame
Learn about popular Python libraries, including Numpy and Pandas, and how they can be used to improve your programming experience. This quiz covers the basics of Python libraries and their applications.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free