I am trying to format a column in a dataframe using style. So far I successfully used the styling for a fixed number of decimals:
mytable.style.format('{:,.2f}', pd.IndexSlice[:, ['Price']])
but I need to expand this to formatting based on value as this:
- if value is >=1000, then format to zero decimal places
- if value is between 1000 and 1, then format to two decimal places
- if value is < 1, then format to five decimal places
Does anyone have a solution for this? Thank you!
