Hi all, my question is simple. All I wanted to know was if there was a recommended way which is used to differentiate between the column vectors and the row vectors using Python?

Up until now, I use SciPy and NumPy and I know when I have to give a single vector something like this:

```from numpy import *
Vector = array([5,6,7])```

This will not tell me if it's a column or a row vector, correct?

And also, check out the following piece of code:

```array([5,6,7]) == array([5,6,7]).transpose()
True```

This is not possible, right? Differentiation is not needed for the functions on the mentioned modules is what I already know of.

Consider this, outer(a,b) or say even a.dot(b) - But then it would be nicer if I could differentiate it at my own convenience, don't you think?

All help appreciated!

Jan 23, 2019 in Python
edited Jan 23, 2019 1,460 views

## 1 answer to this question.

Hi, good question. What you can do to fix this is to make it explicit to forcing on the dimension to the array.

Check out the following piece of code for clarity:

```>>> a = np.array([5, 6, 7])
>>> a
array([5, 6, 7])
>>> a.transpose()
array([5, 6, 7])
>>> a.dot(a.transpose())
14```

Now, you use the column vector for specificity and you make sure that it is forced upon and used.

Check out the below code:

```>>> a.shape = (3,1)
>>> a
array([,
,
])
>>> a.transpose()
array([[5, 6, 7]])
>>> a.dot(a.transpose())
array([[1, 2, 3],
[2, 4, 6],
[3, 6, 9]])```

Hope this helped!

• 3,560 points

## How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

## How do I create 3 X 4 array of random numbers between 0 and 100 using python?

Use numpy in the following manner: np.random.rand(3,4)*100 When you ...READ MORE

## How can I find the files and skip the directories using os.listdir in python?

When I am using os.listdir I am ...READ MORE

## How i can print and count all the all element when i search like " Automation step by step" in Google using python selenium

I am trying to count all the ...READ MORE

## how do i change string to a list?

suppose you have a string with a ...READ MORE

## Lowercase in Python

You can simply the built-in function in ...READ MORE

## Removing surrounding whitespace

Try the strip() function:  s = s.strip() If you ...READ MORE

## How can I arrange the words in ascending order?

Yes there is a function in python ...READ MORE