Comments

Numpy Tutorial_2




Convert List, Tuple, Set, Dic to Numpy array

Numpy work with array, any array object in numpy called ndarray


[['1' '2' '3' '4']
 ['H' 'E' 'N' 's']
 ['3' '4' '5' '6']]
<class 'numpy.ndarray'>
[[1 2 3 4]
 [4 5 6 7]]
[{1, 2, 3} {4, 5, 6}]
{'inas': 1, 'hyder': 2, 'yusuf': 3, 'mariam': 4} <class 'numpy.ndarray'>

Dimensions in array

[1] <class 'numpy.ndarray'>
[1 2 3 4] <class 'numpy.ndarray'>
[['1' '2' '3' '4']
 ['H' 'E' 'N' 's']] The dim of array is: 2
[[['1' '2' '3' '4']]

 [['H' 'E' 'N' 's']]] The dim of array is: 3
[[[['1' '2' '3' '4']]

  [['H' 'E' 'N' 's']]]] The dim of array is: 4
[[[[[1 2 3 4]]]]] The dim of array is: 5


Convert from any Dimaention to N-Dimension

[[[[[1 2 3]]]]] The dim of array is: 5
Share on Google Plus

About Inas AL-Kamachy

    Blogger Comment
    Facebook Comment

0 Comments:

Post a Comment