Last active
February 17, 2023 03:43
-
-
Save microprediction/3d97ab7896dc5f6e1739deab76180a1a to your computer and use it in GitHub Desktop.
Force numpy array to be column or row
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def at_least_2d_column(x): | |
return at_least_2d_row(x).T | |
def at_least_2d_row(x): | |
return np.atleast_2d(np.ravel(x)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment