scautable icon indicating copy to clipboard operation
scautable copied to clipboard

setting print formats per col?

Open Quafadas opened this issue 6 months ago • 1 comments

Currently, we ewither get a toString, or we need to manipate strings ourselves;

def typedCols = data
    .mapColumn["Inception Date", LocalDate](dateStr => LocalDate.parse(dateStr, dtf))
    .mapColumn["ROL", String](_.toDouble.formatAsPercentage)

Which forces you to either shed the type information or accept default formatting.

Proposal: would be to accept a NamedTuple which is a subset of the current NamedTuple, but contains a [A => String] in the printing functions

Pseudocode ?

val formatter = (
 ROL = ((rol: Double) => rol.formatAsPercentage)
)

typedCols.toSeq.ptbln(formatter)

Quafadas avatar May 13 '25 07:05 Quafadas

Other options include punting this in it's entirety into userland and suggesting they look at something like cats.Show https://typelevel.org/cats/typeclasses/show.html

Quafadas avatar May 13 '25 07:05 Quafadas

transparent traits? Perhaps?

Quafadas avatar Sep 11 '25 17:09 Quafadas