# NamedArrays REPL Issue

**URL:** https://discourse.julialang.org/t/namedarrays-repl-issue/78675
**Category:** General Usage
**Created:** [March 29, 2022, 11:56am UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675 "2022-03-29T11:56:33Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![tlorans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlorans/32/19849_2.png) [@tlorans](https://discourse.julialang.org/u/tlorans)
#### Post date: [March 29, 2022, 11:56am UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/1 "2022-03-29T11:56:33Z")

</div>

Hello everyone,

All my code isn’t working anymore since today, with the following simple MWE:

```julia
x = NamedArray([0,4,5],["a","b","c"])

```

Now output’s:

```julia
ERROR: ArgumentError: reducing over an empty collection is not allowed
Stacktrace:
  [1] _empty_reduce_error()
    @ Base .\reduce.jl:301
  [2] reduce_empty(op::Function, #unused#::Type{Int64})
    @ Base .\reduce.jl:311
  [3] mapreduce_empty(#unused#::typeof(identity), op::Function, T::Type)
    @ Base .\reduce.jl:345
  [4] reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, #unused#::Type{Int64})
    @ Base .\reduce.jl:331
  [5] reduce_empty_iter
    @ .\reduce.jl:357 [inlined]
  [6] mapreduce_empty_iter(f::Function, op::Function, itr::Vector{Int64}, ItrEltype::Base.HasEltype)
    @ Base .\reduce.jl:353
  [7] _mapreduce
    @ .\reduce.jl:402 [inlined]
  [8] _mapreduce_dim
    @ .\reducedim.jl:330 [inlined]
  [9] #mapreduce#725
    @ .\reducedim.jl:322 [inlined]
 [10] mapreduce
    @ .\reducedim.jl:322 [inlined]
 [11] #_maximum#743
    @ .\reducedim.jl:894 [inlined]
 [12] _maximum
    @ .\reducedim.jl:894 [inlined]
 [13] #_maximum#742
    @ .\reducedim.jl:893 [inlined]
 [14] _maximum
    @ .\reducedim.jl:893 [inlined]
 [15] #maximum#740
    @ .\reducedim.jl:889 [inlined]
 [16] maximum
    @ .\reducedim.jl:889 [inlined]
 [17] show(io::IOContext{Base.TTY}, v::NamedVector{Int64, Vector{Int64}, Tuple{OrderedCollections.OrderedDict{String, Int64}}}, maxnrow::Int64)     
    @ NamedArrays C:\Users\tlorans\.julia\packages\NamedArrays\TuJLn\src\show.jl:203
 [18] show(io::IOContext{Base.TTY}, v::NamedVector{Int64, Vector{Int64}, Tuple{OrderedCollections.OrderedDict{String, Int64}}})
    @ NamedArrays C:\Users\tlorans\.julia\packages\NamedArrays\TuJLn\src\show.jl:73
 [19] show(io::IOContext{Base.TTY}, #unused#::MIME{Symbol("text/plain")}, n::NamedVector{Int64, Vector{Int64}, Tuple{OrderedCollections.OrderedDict{String, Int64}}})
    @ NamedArrays C:\Users\tlorans\.julia\packages\NamedArrays\TuJLn\src\show.jl:24

```

BUT, the data exists:

```julia
sum(x .+ 1)

```

will gives:

```julia
12

```

I suspect this is coming from uncompatility between packages, but nothing appeared regarding potential compilation erros.  
My Pkg st is:

```julia
  [a93c6f00] DataFrames v1.3.2
  [31c24e10] Distributions v0.24.18
  [38e38edf] GLM v1.6.1
  [4076af6c] JuMP v0.23.2
  [e4e893b0] Mimi v1.4.0
  [b3ba11de] MimiFUND v3.13.0
  [86f7a689] NamedArrays v0.9.6
  [91a5bcdd] Plots v1.26.0
  [c3e4b0f8] Pluto v0.18.1
  [7f904dfe] PlutoUI v0.7.23
  [92933f4c] ProgressMeter v1.7.1
  [c6596682] QuantileRegressions v0.1.10
  [1463e38c] StatFiles v0.8.0
  [2913bbd2] StatsBase v0.33.16
  [f3b207a7] StatsPlots v0.14.33
  [fdbf4ff8] XLSX v0.7.9

```

Anyone has an idea about the source of the issue please?

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [March 29, 2022, 1:37pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/2 "2022-03-29T13:37:43Z")

</div>

On a completely fresh session in a clean environment, I get

```julia
julia> using NamedArrays

julia> x = NamedArray([0,4,5],["a","b","c"])
3-element Named Vector{Int64}
A │
───┼──
a │ 0
b │ 4
c │ 5

```

This is with NamedArrays v0.9.6 as you have. Have you tried restarting your REPL?

---

<div class="post-metadata">

### Author: ![tlorans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlorans/32/19849_2.png) [@tlorans](https://discourse.julialang.org/u/tlorans)
#### Post date: [March 29, 2022, 1:46pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/3 "2022-03-29T13:46:50Z")

</div>

Yes, I tried to restart the REPL, and VS code also.  
I’ve also reinstalled most of the packages, including NamedArrays.  
But I still have the issue.  
At the moment I just don’t try to output NamedArrays in the REPL anymore, with the use of a simple `;` at the end of the line…

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [March 29, 2022, 1:49pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/4 "2022-03-29T13:49:58Z")

</div>

Have you migrated julia versions? Which are you running?

---

<div class="post-metadata">

### Author: ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)
#### Post date: [March 29, 2022, 1:53pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/5 "2022-03-29T13:53:04Z")

</div>

Ok, I started another fresh environment and REPL and added all of your listed packages except the two involving Mimi. It still works fine for me.

```julia
[a93c6f00] DataFrames v1.3.2
[31c24e10] Distributions v0.25.53
[38e38edf] GLM v1.6.1
[4076af6c] JuMP v1.0.0
[86f7a689] NamedArrays v0.9.6
[91a5bcdd] Plots v1.27.3
[c3e4b0f8] Pluto v0.18.4
[7f904dfe] PlutoUI v0.7.38
[92933f4c] ProgressMeter v1.7.2
[c6596682] QuantileRegressions v0.1.10
[1463e38c] StatFiles v0.8.0
[2913bbd2] StatsBase v0.33.16
[f3b207a7] StatsPlots v0.14.33
[fdbf4ff8] XLSX v0.7.9

```

---

<div class="post-metadata">

### Author: ![tlorans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlorans/32/19849_2.png) [@tlorans](https://discourse.julialang.org/u/tlorans)
#### Post date: [March 29, 2022, 2:12pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/6 "2022-03-29T14:12:07Z")

</div>

Okay, thank you everyone for having tested this.

I will certainly need to remove all packages then. Hope it will work.

---

<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: [March 29, 2022, 2:25pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/7 "2022-03-29T14:25:49Z")

</div>

Just to add your error is in `show`ing the NamedArray, which is also why `x` is defined for you - the operation of creating the object runs fine, but then the REPL fails to print the result. You might want to look for anything in your code or the packages you’re loading that overloads `show`.

---

<div class="post-metadata">

### Author: ![trilobit](https://avatars.discourse-cdn.com/v4/letter/t/a8b319/32.png) [@trilobit](https://discourse.julialang.org/u/trilobit)
#### Post date: [March 30, 2022, 12:09pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/8 "2022-03-30T12:09:46Z")

</div>

tlorans wrote:

> Okay, thank you everyone for having tested this.  
> I will certainly need to remove all packages then. Hope it will work.

Or try another type of arrays.  
i.e. the “ComponentArrays”…IMHO more universal than the “NamedArrays”  
and easier to use.

 ![Untitled](https://global.discourse-cdn.com/julialang/original/3X/4/9/4934e2fba1313a0b4e422dc5f82fc546a8b80f96.webp)

---

<div class="post-metadata">

### Author: ![tlorans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tlorans/32/19849_2.png) [@tlorans](https://discourse.julialang.org/u/tlorans)
#### Post date: [March 31, 2022, 12:50pm UTC](https://discourse.julialang.org/t/namedarrays-repl-issue/78675/9 "2022-03-31T12:50:40Z")

</div>

> [@trilobit](#):
>
> ComponentArrays

Thank you for the suggestion, I will check about it.
