Skip to content

printing does not respect :compact option #2802

@Roger-luo

Description

@Roger-luo

Currently compact printing only removes the last line break

julia> using DataFrames

julia> df = DataFrame(A = 1:4, B = ["M", "F", "F", "M"])
4×2 DataFrame
 Row │ A      B
     │ Int64  String
─────┼───────────────
   11  M
   22  F
   33  F
   44  M

julia> show(IOContext(stdout, :compact=>true), df)
4×2 DataFrame
 Row │ A      B
     │ Int64  String
─────┼───────────────
   11  M
   22  F
   33  F
   44  M

however, the convention should be

IOContext(io::IO, KV::Pair...)

  Create an IOContext that wraps a given stream, adding the specified key=>value pairs to the
  properties of that stream (note that io can itself be an IOContext).

    •  use (key => value) in io to see if this particular combination is in the properties set

    •  use get(io, key, default) to retrieve the most recent value for a particular key

  The following properties are in common use:

    •  :compact: Boolean specifying that values should be printed more compactly, e.g. that
       numbers should be printed with fewer digits. This is set when printing array elements.
       :compact output should not contain line breaks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions