pyramid.utils
.c¶
-
pyramid.utils.
c
(*args)[source][source]¶ Imitates the
c
function from R.Since this whole library is aimed at re-creating in Python what R has already done so well, the
c
function was created to wrapnumpy.concatenate
and mimic the R functionality. Similar to R, this works with scalars, iterables, and any mix therein.Note that using the
c
function on multi-nested lists or iterables will fail!References
[R37] https://stat.ethz.ch/R-manual/R-devel/library/base/html/c.html Examples
Using
c
with varargs will yield a single array:>>> c(1, 2, 3, 4) array([1, 2, 3, 4])
Using
c
with nested lists and scalars will also yield a single array:>>> c([1, 2], 4, c(5, 4)) array([1, 2, 4, 5, 4])
However, using
c
with multi-level lists will fail!>>> c([1, 2, 3], [[1, 2]]) ValueError: all the input arrays must have same number of dimensions