scautable
scautable copied to clipboard
setting print formats per col?
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)
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
transparent traits? Perhaps?