How to repleace some chars in a HTTP --> CSV --> DataFrame workflow?

Here’s one way:

using Pipe: @pipe

urlData = "https://archive.ics.uci.edu/ml/machine-learning-databases/auto-mpg/auto-mpg.data-original"

@pipe HTTP.get(urlData).body |>
    replace!(_, UInt8('\t') => UInt8(' ')) |>
    CSV.File(_, delim=' ', missingstring="NA", ignorerepeated=true, header=false) |> 
    DataFrame

(I don’t think you can call replace on an IOBuffer.)

1 Like