Python | Numpy numpy.ndarray .__ pos __ ()

Using the numpy.ndarray .__ pos __ () method Numpy, , you can multiply each and every element of the array with 1. Therefore, the resulting array having the following value is same as the original array.

Syntax: ndarray .__ pos __ ($ self, /)

Return : + self

Example # 1:
In this example, we see that after applying numpy .__ pos __ () we get a simple array, which can be the same as the original one.

# import important module in python

import numpy as np

 
# make an array with NumPy

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

 
# applying the numpy method .__ pos __ ()

print (gfg .__ pos __ ())

Output:

 [1 -2 3 4 5 6] 

Example # 2:

# import important module in python

import numpy as np

< code class = "undefined spaces">  
# make an array with NumPy

gfg = np.array ([[ 1 , 2 , - 3 , 4 , 5 , 6 ],

[ - 6 , 5 , 4 , 3 , 2 , - < code class = "value"> 1 ]])

 
# applying the numpy method .__ pos __ ()

print (gfg .__ pos __ ())

Exit:

 [[1 2 -3 4 5 6] [-6 5 4 3 2 -1]]