-
Notifications
You must be signed in to change notification settings - Fork 373
Description
DataFrame show() truncations are highly logical for safe general use, but there are some occasions where it would be nice to be able to override the default show() truncations.
For instance
function runanalysis() #produces a dataframe that has results that you want to display on screen and return as an object
df = DataFrame(...)
return df
endjulia> results = runanalysis()
26×3 DataFrames.DataFrame #the report display is truncated as necessary
Currently the user has to do an additional, and unobvious show command to print the entire report.
julia> show(results, allrows = true, allcols = true)
I see two ways to improve this experience:
- When DataFrames are truncated, provide a tip about
show(results, allrows = true, allcols = true) - Allow temporary overriding of the truncations from within the function that wants to return the object
Even if the function has determined that no limit is acceptable for that function's output, 2 may be unsafe if it wasn't temporary, because you can't predict what the user might also try to print in their session.
Therefore, I propose:
DataFrames.forcenextshowall()which only sustains the override for the next show function.
For instance, in DataFrames:
const forceshowall = Ref{Bool}(false)
function forcenextshowall()
forceshowall[] = true
endDefaults in the show functions could be changed to
allrows::Bool = forceshowall[] || !get(io, :limit, false),
allcols::Bool = forceshowall[] || !get(io, :limit, false),and at the end of the show methods they would simply always set
forceshowall[] = falseto reset the override.
cc. @bkamins given we were discussing it in slack