In R, to combine two vectors (or a vector with an element), it's just:
vector_1 <- c("a", "b", "c")
vector_2 <- c("d", "e", "f")
c(vector_1, vector_2)
[1] "a" "b" "c" "d" "e" "f"
How is this accomplished in python(/pandas)?
In R, to combine two vectors (or a vector with an element), it's just:
vector_1 <- c("a", "b", "c")
vector_2 <- c("d", "e", "f")
c(vector_1, vector_2)
[1] "a" "b" "c" "d" "e" "f"
How is this accomplished in python(/pandas)?
Assuming you have
a = ["a", "b", "c"]
b = ["d", "e", "f"]
With Numpy you can do either of the following
c = np.concatenate([a, b])
>>> c
['a' 'b' 'c' 'd' 'e' 'f']
you can also use the more terse (but slightly slower)
c = np.r_[a,b]
>>> c
['a' 'b' 'c' 'd' 'e' 'f']
and if you are keeping it as a python list then you can just simply
c = a + b
>>> c
['a', 'b', 'c', 'd', 'e', 'f']