In Jupyter, triangles are formatted based on the magnitude of values within them:
|
def _get_format_str(data: DataFrame) -> str: |
|
""" |
|
Returns a numerical format string based on the magnitude of the mean absolute value of the values in the |
|
supplied DataFrame. |
|
|
|
Returns |
|
------- |
|
str |
|
""" |
|
if np.all(np.isnan(data)): |
|
return "" |
|
elif np.nanmean(abs(data)) < 10: |
|
return "{0:,.4f}" |
|
elif np.nanmean(abs(data)) < 1000: |
|
return "{0:,.2f}" |
|
else: |
|
return "{:,.0f}" |
We should move the hardcoding out of the function, and make the thresholds configurable:
- Allow configuration of format strings for small/medium/large triangles.
- Allow configuration of thresholds at which a triangle is determined to be small/medium/large.
In Jupyter, triangles are formatted based on the magnitude of values within them:
chainladder-python/chainladder/core/display.py
Lines 97 to 113 in 14becfc
We should move the hardcoding out of the function, and make the thresholds configurable: