Printing arrays, Basic operations, Universal functions Flashcards

1
Q

How does NumPy print one-dimensional arrays?

A

NumPy prints one-dimensional arrays as rows, displaying elements from left to right.

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

What format does NumPy use to print two-dimensional arrays?

A

NumPy prints two-dimensional arrays as matrices, with rows printed from top to bottom.

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

How does NumPy handle large arrays during printing?

A

NumPy skips the middle part of large arrays and only prints the corners, showing the first and last few elements.

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

How are arithmetic operations applied to NumPy arrays?

A

Arithmetic operations are applied elementwise, creating a new array with results.

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

What operator is used for matrix multiplication in NumPy?

A

The @ operator is used for matrix multiplication in NumPy.

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

How can operations be performed along specific axes in NumPy?

A

In NumPy, you can specify an axis parameter in functions like sum(), min(), or max() to perform operations along specific dimensions. For example, if you have a 2D array and want to sum values column-wise, you set axis=0. For row-wise operations, use axis=1. This allows you to aggregate data meaningfully across the chosen dimension.

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

What are universal functions (ufuncs) in NumPy?

A

Universal functions, or ufuncs, are built-in functions in NumPy that operate on each element of an array independently. Examples include np.sin(), np.exp(), and np.log(). Ufuncs return new arrays containing the results of applying the function to each element, enabling efficient mathematical computations without the need for explicit loops.

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

Give an example of a ufunc applied to an array.

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