Numpy recarray.nonzero () function | python

Learn examples from DataCamp guru:

With the sympy.combinatorics.partitions.Partition() method we`re going to split the array elements into one tuple using sympy.combinatorics.partitions.Partition ( ) .

Syntax: sympy.combinatorics.partitions.Partition(array)

Return: Return a members of arrays into one tuple.

Example # 1:
In this example, we see that using sympy.combinatorics.partitions.Partition () we can get members of different arrays.

# import sympy and Relational

from sympy.combinatorics.partitions import Partition

from sympy import *  

 

x, y = symbols ( `xy` )

  
# Using the sympy.combinatorics.partitions.Partition () method

gfg = Partition ([ 1 , 2 ], [ 4 , 5 , 6 ], [ - 12 , - 11 ]) 

 

print (gfg.members)

Exit:

(-12, -11, 1, 2, 4, 5, 6)

Example # 2:

# import sympy and Relational

from sympy.combinatorics.partitions import Partition

from sympy import *  

 

x, y = symbols ( ` xy` )

 
# Using the sympy.combinatorics.partitions.Partition () method

gfg = Partition ([ 3 ], [ 1 , 91 ], [ 2 ], [ 6 ])

 

print (gfg.members)

Output:

(1, 2, 3, 6, 91 )

Learn examples from DataCamp guru: