NumPy - Overview

SciPy Stack

http://www.scipy.org/

  • numpy:

    • core data structure: ndarray(n-dimensional array)
  • pandas:

    • built on top of numpy
    • Series(1-dimensional)
    • DataFrame(2-dimensional)
  • matplotlib:

    • 2D Plotting
  • scikit-learn
  • jupyter

Zip With Index

Pure Python

>>> [[i + 1,value] for (i, value) in enumerate(v)]
[[1, 'a'], [2, 'b'], [3, 'c'], [4, 'd']]

Use numpy:

>>> np.c_[range(1,len(v)+1), v]
array([['1', 'a'],
       ['2', 'b'],
       ['3', 'c'],
       ['4', 'd']], 
      dtype='<U21')
      
>>> type(np.c_[range(1,len(v)+1), v])
<class 'numpy.ndarray'>