# Column read from dataframe is not equal to my string

**URL:** <https://discourse.julialang.org/t/column-read-from-dataframe-is-not-equal-to-my-string/129923>\
**Category:** New to Julia\
**Created:** [June 16, 2025, 12:50pm UTC](https://discourse.julialang.org/t/column-read-from-dataframe-is-not-equal-to-my-string/129923 "2025-06-16T12:50:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![FSUfan](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FSUfan](https://discourse.julialang.org/u/FSUfan)\
**Post date:** [June 16, 2025, 12:50pm UTC](https://discourse.julialang.org/t/column-read-from-dataframe-is-not-equal-to-my-string/129923/1 "2025-06-16T12:50:19Z")

</div>

I read a MySQL table whose values change frequently and put them in a dataframe (df). In my example, the content of the “d8” column is definitely equal to “GM.”  
As mentioned above, the value of “d8” can vary, so I need to check its content and then act accordingly.  
The piece of code says that val1 is not equal to “GM.”  
Where am I going wrong?

```julia
val = df[!,“d8”]
val1 = string.(val)
println(val1)
println(typeof(val1))
    s = 0
    val1 != “GM” ? println(“NOK”) : s += 1

```

Below are the 3 values of println

```julia
> [“GM”]
> Vector{String}
> NOK

```

---

<div class="post-metadata">

**Author:** ![TimG](https://avatars.discourse-cdn.com/v4/letter/t/82dd89/32.png) [@TimG](https://discourse.julialang.org/u/TimG)\
**Post date:** [June 16, 2025, 1:00pm UTC](https://discourse.julialang.org/t/column-read-from-dataframe-is-not-equal-to-my-string/129923/2 "2025-06-16T13:00:13Z")

</div>

Did you try `val1 != [“GM”]` ?

Your first print statement shows `val1` is a vector containing one string and not simply a string. So your test as written will fail.

You could alternatively use `val1[1]` to make the comparison with the first string in the vector.

---

<div class="post-metadata">

**Author:** ![FSUfan](https://avatars.discourse-cdn.com/v4/letter/f/838e76/32.png) [@FSUfan](https://discourse.julialang.org/u/FSUfan)\
**Post date:** [June 16, 2025, 1:10pm UTC](https://discourse.julialang.org/t/column-read-from-dataframe-is-not-equal-to-my-string/129923/3 "2025-06-16T13:10:16Z")

</div>

Both solution work as a charm
