# Append! produces #undef values from missings. Related to WeakRefStrings / JDF

**URL:** <https://discourse.julialang.org/t/append-produces-undef-values-from-missings-related-to-weakrefstrings-jdf/102613>\
**Category:** General Usage\
**Tags:** bug\
**Created:** [August 8, 2023, 7:45pm UTC](https://discourse.julialang.org/t/append-produces-undef-values-from-missings-related-to-weakrefstrings-jdf/102613 "2023-08-08T19:45:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parazetamol](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/parazetamol/32/52125_2.png) [@Parazetamol](https://discourse.julialang.org/u/Parazetamol)\
**Post date:** [August 8, 2023, 7:45pm UTC](https://discourse.julialang.org/t/append-produces-undef-values-from-missings-related-to-weakrefstrings-jdf/102613/1 "2023-08-08T19:45:25Z")

</div>

Hi there,  
i’m afraid I discovered a bug while working with DataFrames and JDF.  
But the problem seems to be related to WeakRefStrings:

What do you think?

Greetings  
Parazetamol

```julia
using DataFrames, JDF

# DataFrames v1.6.1
# JDF v0.5.2
# julia 1.9.2
# ubuntu-22.04

# The story started for me with a DataFrame loaded using JDF:
df1 = DataFrame(b=[1,2], a=[missing,"2"])
df2 = DataFrame(b=[1,2], a=[missing,"2"])

# save for loading later
df1_tmp = tempname()
df2_tmp = tempname()
JDF.save(df1_tmp, df1)
JDF.save(df2_tmp, df2)

append!(df1, df2) # => everything ok

# append! does not work on the same DataFrame loaded
df1 = JDF.load(df1_tmp) |> DataFrame
df2 = JDF.load(df2_tmp) |> DataFrame

# while vcat works fine
vcat(df1, df2) # => everything ok

# append! produces #undef 
append!(df1, df2) # => resulting df1.a has a row containing #undef instead of missing.

# problem seems to be related to WeakRefStrings:
# restore df1
df1 = JDF.load(df1_tmp) |> DataFrame

v1 = df1[!,:a]
# ->
# 4-element WeakRefStrings.StringVector{Union{Missing, String}}:
# missing
# "2"
v2 = df2[!,:a]

append!(v1, v2)

# ->
# 4-element WeakRefStrings.StringVector{Union{Missing, String}}:
# missing
# "2"
# #undef
# "2"

```
