Typesetting is generally hackable (e.g. $\TeX$ or Makeboxes[]), although that does not mean it is safe to hack it. Numeric expressions in a Dataset[] display that are not numbers are typeset by abox[], which is not protected. We can use a boolean flag $showTypesetExact so that the output is not numericized and overwrite DownValues[TypeSystem`NestedGrid`PackagePrivate`abox][[15]] thus:
TypeSystem`NestedGrid`PackagePrivate`abox[
TypeSystem`NestedGrid`PackagePrivate`other_] :=
If[NumericQ[TypeSystem`NestedGrid`PackagePrivate`other] &&
!TrueQ[$showTypesetExact], (* new!!! *)
TextString[N[TypeSystem`NestedGrid`PackagePrivate`other]],
Block[{$SummaryBoxDataSizeLimit = \[Infinity]},
StyleBox[
MakeBoxes[TypeSystem`NestedGrid`PackagePrivate`other] /.
TypeSystem`NestedGrid`PackagePrivate`boxes :
TypeSystem`NestedGrid`PackagePrivate`summaryBoxesPattern :>
RuleCondition[
TypeSystem`NestedGrid`PackagePrivate`simplifySummaryBoxes[
TypeSystem`NestedGrid`PackagePrivate`boxes], True],
FontFamily ->
Dynamic[CurrentValue[{"StyleHints", "CodeFont"}],
ImageSizeCache -> {198.89999999999998, {0.23399999999999999,
13.767}}], ShowStringCharacters -> True]]]
$showTypesetExact = True;
ds = Dataset[Association[{"p1" -> 1/3, "p2" -> 2 Pi + Sqrt[2]}]]
Note that the Dataset[] typesetting functionality expects boxes from abox[]. It often uses TextString, which has its own ideas about numericizing exact expressions.
Pi + Sqrt[2] // TextString
2 Pi // TextString
Pi // TextString
6980579422424269/2251799813685248 // TextString
(*
"4.55581"
"6.28319"
"Pi"
"3.1"
*)
One might want to judiciously choose when to show the exact expression and when not. The typesetting choices of Dataset[] reflect a goal of having the displaying summarize the data (approximately, in some cases), which is at odds with the OP's goals. Mathematica's goal here is similar to that of Root[] object typesetting. From that viewpoint, the numericized display of pi seems more likely to be a design choice rather than an unintentional bug.
This reverts to the old behavior:
$showTypesetExact = False;
ds = Dataset[Association[{"p1" -> 1/3, "p2" -> 2 Pi + Sqrt[2]}]]
Note the value of $showTypesetExact is used at the moment of typesetting the Dataset[] expression, which happens after the kernel is done computing the Dataset[] and has sent the result to the front end. If you wish to temporarily change the value of $showTypesetExact, Makeboxes[] has to be called while the change is in effect to see the desired output.
Examples:
This works:
$showTypesetExact = True;
Dataset[Association[{"p1" -> 1/3, "p2" -> 2 Pi + Sqrt[2]}]]
$showTypesetExact = False;
This fails:
$showTypesetExact = False;
Block[{$showTypesetExact = True},
Dataset[Association[{"p1" -> 1/3, "p2" -> 2 Pi + Sqrt[2]}]]
]
Dataset[Association[{"p1" -> 1/3, "p2" -> Pi}]] // Normalgives<|"p1" -> 1/3, "p2" -> \[Pi]|>. UsingItemDisplayFunction -> (StandardForm[#] &)]as proposed by @user1066 one can see the data as initially defined (Pi). $\endgroup$FullForm[Dataset[o]]you see thatPihas not been converted. It is only the display of the data set that is incorrect $\endgroup$