# Frequent error

**URL:** https://discourse.julialang.org/t/frequent-error/41784
**Category:** New to Julia
**Created:** [June 20, 2020, 5:31pm UTC](https://discourse.julialang.org/t/frequent-error/41784 "2020-06-20T17:31:05Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)
#### Post date: [June 20, 2020, 5:31pm UTC](https://discourse.julialang.org/t/frequent-error/41784/1 "2020-06-20T17:31:05Z")

</div>

![off](https://global.discourse-cdn.com/julialang/original/3X/d/a/daf851f91bb43c0a71a9140bd9a718db18848e41.jpeg)

Hello,

I am new here and I do get this error often…I revise my code several time…I didnot specify the type of the variables in my function yet I get this error when I call the function…What is the meaning of this error as it seems to me like I donot get it and how do I fix it ?

Thank you

---

<div class="post-metadata">

### Author: ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)
#### Post date: [June 20, 2020, 6:20pm UTC](https://discourse.julialang.org/t/frequent-error/41784/2 "2020-06-20T18:20:21Z")

</div>

so it looks like you have a `DataFrame` whose column already have types, for example this could be what you’re doing:

```julia
julia> df
3×2 DataFrame│ Row │ a │ b │
│ │ Float64 │ String │
├─────┼─────────┼────────┤
│ 1 │ 1.0 │ x │
│ 2 │ 1.0 │ y │
│ 3 │ 1.0 │ γ │

julia> df.b .= "a"3-element Array{String,1}:
 "a"
 "a"
 "a"

julia> df.a .= "a"
ERROR: MethodError: Cannot `convert` an object of type String to an object of type Float64
Closest candidates are:
  convert(::Type{T}, ::T) where T<:Number at number.jl:6
  convert(::Type{T}, ::Number) where T<:Number at number.jl:7
  convert(::Type{T}, ::Base.TwicePrecision) where T<:Number at twiceprecision.jl:250
  ...
Stacktrace:
 [1] fill!(::Array{Float64,1}, ::String) at ./array.jl:336
 [2] copyto! at ./broadcast.jl:872 [inlined]
 [3] materialize!(::Array{Float64,1}, ::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{0},Nothing,typeof(identity),Tuple{Base.RefValue{String}}}) at ./broadcast.jl:823
 [4] top-level scope at REPL[10]:1

```

if you need to replace the column, you need the following syntax:

```julia
df[!, :a] .= "a"

```

to change the type of the column entirely

---

<div class="post-metadata">

### Author: ![bernhard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bernhard/32/2619_2.png) [@bernhard](https://discourse.julialang.org/u/bernhard)
#### Post date: [June 20, 2020, 7:39pm UTC](https://discourse.julialang.org/t/frequent-error/41784/3 "2020-06-20T19:39:20Z")

</div>

Btw. The error is probably on line 93 of general.jl as shown in your screenshot.

If you have not solved this already, maybe you could post the code from that file.

---

<div class="post-metadata">

### Author: ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)
#### Post date: [June 20, 2020, 10:28pm UTC](https://discourse.julialang.org/t/frequent-error/41784/4 "2020-06-20T22:28:40Z")

</div>

Thank you

---

<div class="post-metadata">

### Author: ![mayar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mayar/32/16426_2.png) [@mayar](https://discourse.julialang.org/u/mayar)
#### Post date: [June 20, 2020, 10:29pm UTC](https://discourse.julialang.org/t/frequent-error/41784/5 "2020-06-20T22:29:01Z")

</div>

yes solved it …Thank you
