Back to notes
How do you launch a Jupyter Notebook from the command prompt?
Press to flip
Open the command prompt as Administrator, change directory using `cd` command, and type `jupyter notebook`.
How would you perform a column-wise sort on a numpy array `arr1`?
`np.sort(arr1, axis=0)`
Why is it important to understand that numpy relies on precompiled C libraries?
It impacts the performance and memory allocation considerations while working with numpy.
How can you sort a numpy array `arr1`?
`np.sort(arr1)`
How do you create a 2x3 numpy array with the values [1, 2, 3] and [4, 5, 6]?
`arr1 = np.array([[1, 2, 3], [4, 5, 6]])`
If the dimensions of two matrices are not compatible for dot product, what operation can be applied to one of them?
Use the transpose function, e.g., `arr2.T` for `arr2`.
How do you specify the sorting algorithm when sorting a numpy array? Provide an example using `mergesort`.
`np.sort(arr1, kind='mergesort')`
List three sorting algorithms available in numpy.
'quicksort', 'heapsort', 'mergesort'
What command is used to import the numpy library in Python?
`import numpy as np`
What function would you use to compute the dot product of two matrices `arr1` and `arr2`?
`np.dot(arr1, arr2)`
How can you compute the row-wise sum of a numpy array `arr1`?
`arr1.sum(axis=1)`
What does setting `axis=0` in a numpy function do?
It performs the operation column-wise.
What does setting `axis=1` in a numpy function do?
It performs the operation row-wise.
What function in numpy is used to calculate the cross product of two vectors?
`np.cross(arr1, arr2)`
How can you compute the column-wise sum of a numpy array `arr1`?
`arr1.sum(axis=0)`
Previous
Next