我尝试了很多库,但似乎我无法获得匹配的类型.
典型的尝试:
using SomeLib, CSV
fh = SomeLib.open("gzipped_file.gz")
CSV.read(fh) # error
Run Code Online (Sandbox Code Playgroud)
例:
using CodecZlib
CSV.read(GzipDecompressorStream(open("gzipped_file.gz")))
# ERROR: MethodError: no method matching position(::TranscodingStreams.TranscodingStream{GzipDecompressor,IOStream})
Run Code Online (Sandbox Code Playgroud)
在此期间,您可以使用CSVFiles.jl:
using CSVFiles, DataFrames, FileIO
open("yourfile.csv.gz") do io
load(Stream(format"CSV", GzipDecompressorStream(io))) |> DataFrame
end
Run Code Online (Sandbox Code Playgroud)