1

I'm reading this textbook called "Practical Statistics for Data Scientists" and this :.3f keeps getting used in almost every f-string. What does :.3f mean? My guess is it has something to do with floating point numbers.

Example:

 {house_lm_factor.intercept_:.3f}
I'mahdi
  • 23,382
  • 5
  • 22
  • 30
Allie W.
  • 11
  • 1
  • 5

1 Answers1

0

This is show you how many number are printing:

>>> import math
>>> flt = math.pi
>>> f'{flt:.3f}'
'3.142'

>>> f'{flt:.5f}'
'3.14159'

>>> f'{flt:.10f}'
'3.1415926536'
I'mahdi
  • 23,382
  • 5
  • 22
  • 30