Skip to content

Instantly share code, notes, and snippets.

@agalea91
Last active June 30, 2016 20:16
Show Gist options
  • Save agalea91/9329b72552a9169c558c11dccc43720c to your computer and use it in GitHub Desktop.
Save agalea91/9329b72552a9169c558c11dccc43720c to your computer and use it in GitHub Desktop.
All glory to NumPy! Long may it live.

Useful commands for Numpy

import numpy as np


Arrays

  • Random mask for shuffle
    np.random.permutation(size)
  • Split array a into N pieces
    np.array_split(a, N)
  • Initialize empty array and join
    a = np.empty(shape=(0, b.shape[1]))
    np.concatenate((a, b), axis=0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment