# Is there an easy way to convert all data in DataFrame (or Matrix) to INT?

**URL:** <https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804>\
**Category:** Data\
**Created:** [April 22, 2021, 1:34pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804 "2021-04-22T13:34:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Igor\_Douven](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/igor_douven/32/8433_2.png) [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Post date:** [April 22, 2021, 1:34pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804/1 "2021-04-22T13:34:24Z")

</div>

Hi all,

I’m trying to import a .csv file with missing values (just blanks, in the file). I’m using `CSV.jl` together with `DataFrames.jl` for this. I notice that the columns containing a missing value are all of type `String` instead of `Int64`. Is there an easy way to convert all strings to integers?

---

<div class="post-metadata">

**Author:** ![bkamins](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bkamins/32/208538_2.png) [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Post date:** [April 22, 2021, 1:35pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804/2 "2021-04-22T13:35:30Z")

</div>

can you share the input data please? (a sample is enough)

---

<div class="post-metadata">

**Author:** ![Igor\_Douven](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/igor_douven/32/8433_2.png) [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Post date:** [April 22, 2021, 3:33pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804/3 "2021-04-22T15:33:48Z")

</div>

Sure. How do I do that?

---

<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:** [April 22, 2021, 3:41pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804/4 "2021-04-22T15:41:29Z")

</div>

ex: [dropbox.com](http://dropbox.com) ?

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [April 22, 2021, 3:42pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804/5 "2021-04-22T15:42:20Z")

</div>

You can just copy and paste the first few lines of your CSV file (assuming there aren’t too may columns).

What’s likely happening is that you don’t have the keyword argument `missingstring` set correctly when you read in the CSV. For instance, if your CSV is full of `"NA"`s, then set `missingstring="NA"`

---

<div class="post-metadata">

**Author:** ![Igor\_Douven](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/igor_douven/32/8433_2.png) [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Post date:** [April 22, 2021, 3:58pm UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-convert-all-data-in-dataframe-or-matrix-to-int/59804/6 "2021-04-22T15:58:54Z")

</div>

Thanks, I didn’t know about `missingstring`. This worked!
