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

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?

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

1 Like

Sure. How do I do that?

ex: dropbox.com ?

1 Like

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"

3 Likes

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