# Accessing a column from a vector of vectors

**URL:** https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722
**Category:** General Usage
**Tags:** arrays, vector
**Created:** [April 15, 2026, 11:25am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722 "2026-04-15T11:25:05Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Ju\_ska](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)
#### Post date: [April 15, 2026, 11:25am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/1 "2026-04-15T11:25:05Z")

</div>

Hi,

I have something like:

```julia-auto
a = [["a", "1" ,"11"],
     ["b", "2" ,"22"],
     ["c", "3" ,"33"]]

3-element Vector{Vector{String}}:
 ["a", "1", "11"]
 ["b", "2", "22"]
 ["c", "3", "33"]

```

And I would like to get e.g. the “a, b, c” or “1, 2, 3” vectors.  
Tried various [:,:][…] combos with success.

---

<div class="post-metadata">

### Author: ![matthias314](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@matthias314](https://discourse.julialang.org/u/matthias314)
#### Post date: [April 15, 2026, 11:35am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/2 "2026-04-15T11:35:16Z")

</div>

Are you looking for something more sophisticated than the following?

```julia-auto
julia> map(v -> v[1], a)
3-element Vector{String}:
 "a"
 "b"
 "c"

```

---

<div class="post-metadata">

### Author: ![Ju\_ska](https://avatars.discourse-cdn.com/v4/letter/j/ecd19e/32.png) [@Ju\_ska](https://discourse.julialang.org/u/Ju_ska)
#### Post date: [April 15, 2026, 11:38am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/3 "2026-04-15T11:38:13Z")

</div>

Nope, I wondered if the [:,:] kind of syntax would be usable.  
Working fine, thanks.

---

<div class="post-metadata">

### Author: ![langestefan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/langestefan/32/207923_2.png) [@langestefan](https://discourse.julialang.org/u/langestefan)
#### Post date: [April 15, 2026, 11:38am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/4 "2026-04-15T11:38:40Z")

</div>

```julia
julia> getindex.(a,1)
3-element Vector{String}:
 "a"
 "b"
 "c"

```

also works

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [April 15, 2026, 2:27pm UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/5 "2026-04-15T14:27:12Z")

</div>

And in the specific case for the a, b, c vector

```julia-auto
julia> first.(a)
3-element Vector{String}:
 "a"
 "b"
 "c"

```

(or `last` for the last “column”, but `getindex` more generally as mentioned above)

---

<div class="post-metadata">

### Author: ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)
#### Post date: [June 1, 2026, 4:51pm UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/6 "2026-06-01T16:51:19Z")

</div>

```julia-auto
[a...;;][1,:]
[a...;;][2,:]

```

---

<div class="post-metadata">

### Author: ![Dan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dan/32/42581_2.png) [@Dan](https://discourse.julialang.org/u/Dan)
#### Post date: [June 1, 2026, 10:49pm UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/7 "2026-06-01T22:49:18Z")

</div>

Another method could be:

```julia-auto
julia> using IterTools

julia> nth.(a, 1)
3-element Vector{String}:
 "a"
 "b"
 "c"

```

Note the broadcasting used with `nth` (that is `nth.(...)`).

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [June 2, 2026, 9:55am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/8 "2026-06-02T09:55:19Z")

</div>

Also:  
`stack(a)[1,:]`

And:

```julia-auto
using TensorCast
@cast b[i] := a[i][1]

```

---

<div class="post-metadata">

### Author: ![rocco\_sprmnt21](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rocco_sprmnt21/32/20127_2.png) [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)
#### Post date: [June 2, 2026, 10:22am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/9 "2026-06-02T10:22:48Z")

</div>

What are the drawbacks to defining a specific syntax for this case?  
For example like `a[:][1]`

---

<div class="post-metadata">

### Author: ![eldee](https://avatars.discourse-cdn.com/v4/letter/e/b5a626/32.png) [@eldee](https://discourse.julialang.org/u/eldee)
#### Post date: [June 2, 2026, 10:45am UTC](https://discourse.julialang.org/t/accessing-a-column-from-a-vector-of-vectors/136722/10 "2026-06-02T10:45:25Z")

</div>

Well, the syntax `a[:][1]` already exists: it copies `a` and then selects that copy’s first element.

More generally, a `Vector{Vector}` is not a `Matrix` (e.g. it can be ragged), so it’s not the natural concept to use when talking about things like columns.
