CSVFiles: read file with non-standard extension


#1

I’m trying to use CSVFiles.jl to read a .tsv file that has a non-standard file extension (which cannot easily be changed).

The readme suggests

df = DataFrame(load(Stream(format"CSV", io)))

But trying to apply this pattern results in the following error:

path  = "/file/tree/my_nonstandard_file.1b"
f = open(path)
df = load(Stream(format"CSV", f)) |> DataFrame
head(df)

What am I doing wrong here?

(By the way, I know there are alternatives (CSV.jl, DelimitedFiles etc.), but I would like to make CSVFiles work in this case)


#2

( I am not tested )

but, based on the : https://github.com/queryverse/CSVFiles.jl/blob/master/test/runtests.jl#L128
can you test with

  • fileiostream = FileIO.Stream(FileIO.format"TSV", stream)

so with: format"TSV"


#3

Seems to be a bug in TextParse.jl: https://github.com/JuliaComputing/TextParse.jl/pull/86


#4

Unfortunately does not work either.

I see, then I’ll wait for the merge. Thanks!


#5

Can you try

using CSVFiles, DataFrames, FileIO

path  = "/file/tree/my_nonstandard_file.1b"
df = load(File(format"TSV", path)) |> DataFrame

#6

Works like a charm! Maybe this could be reflected in the README.md of CSVfiles.


#7