how do I disply an np.array in column with xlwings
Question: I have the following code in python with xlwings

    
    
    @xlfunc
    @xlarg('x', 'nparray', ndim=1)
    @xlarg('y', 'nparray', ndim=1)
    def test_sum(x,y):
        return(x+y)
    

Once in excel, I submit ctrl+shift+Enter but it displays the result in a line
and not in column. How can I correct this ?


Answer: Since you are forcing your inputs to be 1-dimensional numpy arrays of the form
`np.array([1, 2, 3])`, the result is a 1-dim numpy array as well which are
(like simple lists) interpreted as row orientation when written to Excel. To
write an array in column orientation, you'll need to return two dimensional
arrays of the form `np.array([[1], [2], [3]])` or for lists: `[[1], [2],
[3]]`.

In your case, you could simply change `ndim=1` to `ndim=2`and it will be
returned in column orientation if the inputs are columns as well. If you would
like to keep the inputs in 1d (for whatever reason), then you could force the
output into column orientation e.g. by doing this:

    
    
    from xlwings import xlfunc, xlarg
    import numpy as np
    
    @xlfunc
    @xlarg('x', 'nparray', ndim=1)
    @xlarg('y', 'nparray', ndim=1)
    def test_sum(x,y):
        return(x+y)[:, np.newaxis]
    

You're right that the [docs](http://docs.xlwings.org/udfs.html#number-of-
array-dimensions-ndim) aren't clear enough about this.

