MOBI BOOT CAMP CORP. logoLearning Buddy
  • SIGN IN
  • Introduction
  • 1: NumPy Module
    • NumPy Arrays
    • Broadcasting in NumPy Arrays
    • Quiz
    • Colab Exercise
  • 2: Pandas Module
  • 3: Pandas - More on Dataframes
  • 4: Matplotlib Module
  • 5: Seaborn Module
  • 6: Plotly Express Module
  • 7: GeoSpatial Modules
  • 8. Other Popular Libs
  • 9. Data Driven Stories
  • 10. Bad Visualization Example
  • 11. Glossary
  • Slides-1
  • Slides-2

When the following statement is run, what is the data type of the elements in this NumPy array?


import numpy as np
np.array(['ab', False])

Error, because it has mixed types Both String and Boolean String The boolean `False` is converted to a string, so all elements in the array are strings.
<question >
        <p>Study the given NumPy array. What is the size of the array found by using the `size` attribute?<br>
        <pre><code>

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

6 (3, 2) (2, 3) Size is the total number of elements in the array.

Study the given NumPy array. What is the number of dimensions found by using the `ndim` attribute of the array?


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

2 3 6 This is a two-dimensional array because it has rows and columns.

Study the given NumPy array. What is the shape of the array found by using the `shape` attribute?


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

6 (3, 2) (2, 3) The shape is (row count, column count) for a 2D array.

Exercise

More Exercises: https://www.w3resource.com/python-exercises/numpy/basic/index.php

Privacy Policy | Terms & Conditions