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}
2
  • 1
    "format this value as a float to 3 decimal places" Commented Oct 18, 2021 at 11:27
  • Please se Format Specification Mini-Language Commented Oct 18, 2021 at 11:33

1 Answer 1

1

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'
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.