I am new to numpy and I keep getting confused in arguments passing, some times its list and some times tuple, like this https://numpy.org/doc/stable/reference/generated/numpy.vstack.html
numpy.vstack(tup)
doc says it takes tuple, but if I pass list it also works
np.vstack((c1, c2))
array([[1, 1],
[2, 2],
[3, 3],
[4, 4]])
and with list its the same output
np.vstack([c1, c2])
array([[1, 1],
[2, 2],
[3, 3],
[4, 4]])
CodePudding user response:
As @hpaulj correctly says, the input parameter is just named tup
but tup
just has to be a sequence of np.arrays.
A sequence can be things like a tuple, array, pandas.Series etc.
If it has to be only a tuple it would be stated as such i.e "tup: tuple" and not "tup: sequence" in the docs