Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert np shape (a,) to (a,1)

# numpy array/vector (n,) dimension -> (n,1) dimension conversion
a  = np.arange(3)         # a.shape  = (3,)
b  = a.reshape((3,1))     # b.shape  = (3,1)
c  = b.reshape((3,))      # c.shape  = (3,)

c2 = b.reshape((-1,1))    # c2.shape = (3,)
Comment

PREVIOUS NEXT
Code Example
Python :: position in array python 
Python :: backtracking python 
Python :: random 0 or 1 python 
Python :: select columns to include in new dataframe in python 
Python :: python sns lable axes 
Python :: install a lower version of python using conda 
Python :: discord py check if user has permission return message if not 
Python :: extends template django 
Python :: Determine the sum of al digits of n 
Python :: numpy array split 
Python :: Get Time from timestamp in python 
Python :: python multiplication array 
Python :: Python program to implement linear search and take input. 
Python :: python filter data from list 
Python :: python copy to clipboard command 
Python :: python code to replace first value of txt file 
Python :: django active link 
Python :: connectionrefusederror at /accounts/signup/ django allauth 
Python :: how to install tkinter in pycharm 
Python :: Game of Piles Version 2 codechef solution 
Python :: How to remove all characters after a specific character in python? 
Python :: pip install covid 
Python :: numpy calculate standard deviation 
Python :: python argparse custom categories 
Python :: Matplotlib rotated xticklabels 
Python :: run python script every hour 
Python :: dataframe to tf data 
Python :: python cholesky 
Python :: if else in list comprehension 
Python :: python pandas read csv from txt tab delimiter 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =