Trusted answers to developer questions

Maria Elijah

`numpy.cbrt()`

methodThe ** numpy.cbrt() function** calculates the cube root of an input array. This is done element by element.

Note:In Python, we can use a list of lists to create a two-dimensional (2-D) array.

```
numpy.cbrt(x,out=None, where=True)
```

: This specifies the input array.`x`

: This is an optional parameter. It represents the location where the result is stored.`out`

: This is an optional parameter. It represents the condition in which the input gets broadcasted.`where`

The `numpy.cbrt()`

method returns the cube root of an input array.

The following code shows how to use the `numpy.cbrt()`

method for two-dimensional (2-D) arrays in Python.

# import numpy import numpy as np # create 2D array using np.array x = np.array([[6,3,7,2], [8,6,9,5]]) # Compute the cube root # using np.cbrt() result = np.cbrt(x) print(result)

Implementation of numpy.crbt() method

- Line 2: We import the library
`numpy`

. - Lines 4–6: We create a two-dimensional array called
`x`

. - Line 7: To calculate the cube root of the input array
`x`

, we use the`np.cbrt()`

method. - Line 9: We display the result.

RELATED TAGS

numpy

python3

CONTRIBUTOR

Maria Elijah

RELATED COURSES

View all Courses

Keep Exploring

Related Courses