# Internals

Internal API

The functions, methods and types listed on this page are internal to DataFrames and are not considered to be part of the public API.

DataFrames.compacttypeFunction
compacttype(T::Type, maxwidth::Int=8, initial::Bool=true)

Return compact string representation of type T.

For displaying data frame we do not want string representation of type to be longer than maxwidth. This function implements rules how type names are cropped if they are longer than maxwidth.

source
DataFrames.gennamesFunction
gennames(n::Integer)

Generate standardized names for columns of a DataFrame. The first name will be :x1, the second :x2, etc.

source
DataFrames.getmaxwidthsFunction
DataFrames.getmaxwidths(df::AbstractDataFrame,
io::IO,
rowindices1::AbstractVector{Int},
rowindices2::AbstractVector{Int},
rowlabel::Symbol,
rowid::Union{Integer, Nothing},
show_eltype::Bool,
buffer::IOBuffer)

Calculate, for each column of an AbstractDataFrame, the maximum string width used to render the name of that column, its type, and the longest entry in that column – among the rows of the data frame will be rendered to IO. The widths for all columns are returned as a vector.

Return a Vector{Int} giving the maximum string widths required to render each column, including that column's name and type.

NOTE: The last entry of the result vector is the string width of the implicit row ID column contained in every AbstractDataFrame.

Arguments

• df::AbstractDataFrame: The data frame whose columns will be printed.
• io::IO: The IO to which df is to be printed
• rowindices1::AbstractVector{Int}: A set of indices of the first chunk of the AbstractDataFrame that would be rendered to IO.
• rowindices2::AbstractVector{Int}: A set of indices of the second chunk of the AbstractDataFrame that would be rendered to IO. Can be empty if the AbstractDataFrame would be printed without any ellipses.
• rowlabel::AbstractString: The label that will be used when rendered the numeric ID's of each row. Typically, this will be set to "Row".
• rowid: Used to handle showing DataFrameRow.
• show_eltype: Whether to print the column type under the column name in the heading.
• buffer: buffer passed around to avoid reallocations in ourstrwidth
source
DataFrames.ourshowFunction
DataFrames.ourshow(io::IO, x::Any, truncstring::Int)

Render a value to an IO object compactly using print. truncstring indicates the approximate number of text characters width to truncate the output (if it is a non-positive value then no truncation is applied).

source
DataFrames.ourstrwidthFunction
DataFrames.ourstrwidth(io::IO, x::Any, buffer::IOBuffer, truncstring::Int)

Determine the number of characters that would be used to print a value.

source
DataFrames.@spawn_for_chunksMacro
@spawn_for_chunks basesize for i in range ... end

Parallelize a for loop by spawning separate tasks iterating each over a chunk of at least basesize elements in range.

A number of task higher than Threads.nthreads() may be spawned, since that can allow for a more efficient load balancing in case some threads are busy (nested parallelism).

source