JuliaData / JuliaData/DataFrames.jl

printing does not respect :compact option

Open
#2,802 16 comments 0 reactions 1 assignee View on GitHub

@ronisbr is already working on this.

Since Jun 24, 2021.

display feature
Dominant language
Julia
Stars
1.8k
Forks
372
Avg merge
5d 7h
Merged PRs (30d)
5

Description

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
─────┼───────────────
   1 │     1  M
   2 │     2  F
   3 │     3  F
   4 │     4  M

julia> show(IOContext(stdout, :compact=>true), df)
4×2 DataFrame
 Row │ A      B
     │ Int64  String
─────┼───────────────
   1 │     1  M
   2 │     2  F
   3 │     3  F
   4 │     4  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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.