DataFrameTools.jl Documentation
Functions
DataFrameTools.file_format
— Functionfile_format(file::AbstractString)::Symbol
Returns the file format from the file suffix.
Arguments
file::AbstractString
: file path
DataFrameTools.compression_formats
— Functioncompression_formats()::Vector{Symbol}
Returns the file formats supported for compressed archives.
DataFrameTools.compress
— Functioncompress(f::Function, file::AbstractString, subfile::AbstractString)
Creates a compressed file. The type of compression is inferred from the output file name. subfile is the name of the file within the compressed archive. f is a function which writes to the archive.
The typical use case is:
compress(file, subfile) do io
# put here the body of function f(io) to write to io
end
Arguments
f::Function
: function to execute on the file contentsfile::AbstractString
: compressed file pathsubfile::AbstractString
: subfile within the archive
DataFrameTools.uncompress
— Functionuncompress(f::Function, file::AbstractString)
Uncompresses a compressed file. The type of compression is inferred from the output file name. f is a function which reads from the archive.
The typical use case is:
uncompress(file) do io
# put here the body of function f(io) to write to io
end
Arguments
f::Function
: function to execute on the file contentsfile::AbstractString
: file path
DataFrameTools.df_formats
— Functiondf_formats()::Vector{Symbol}
Returns the file formats supported for DataFrames.
DataFrameTools.df_write
— Functiondf_write(file::AbstractString, df::DataFrame; subformat::Union{Nothing,Symbol}=nothing, dictencode::Bool=true)
Writes a DataFrame to a file. The file suffix determines how the DataFrame is serialized. If the file has a compressed suffix, subformat determines how the DataFrame is serialized in the compressed archive.
Arguments
file::AbstractString
: file pathdf::DataFrame
: dataframe to exportsubformat::Union{Nothing,Symbol}=nothing
: format to used within a compressed archive.dictencode::Bool=true
: true to use a dictionary encoding, if possible, and false otherwise.
DataFrameTools.df_read
— Functiondf_read(file::AbstractString; dates_as_strings::Bool=true, missing_type::Type=String, missing_types::Dict{String,Type}=Dict{String,Type}())::DataFrame
Reads a DataFrame from a file. The file suffix determines how the DataFrame is deserialized.
Arguments
file::AbstractString
: file pathdates_as_strings::Bool=true
: true to parse dates as strings; false to parse dates as dates.missing_type::Type=String
: type to use if all values are missing,missing_types::Dict{String,Type}=Dict{String,Type}()
: type to use for missing columns