-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
Milestone
Description
Styler has its own format() method that sets a formatter for columns, and a function set_na_rep() for dealing with missing data.
It seems the two do not play well together:
df = pd.DataFrame([[1,2],[3,4]])
df.iloc[0,0] = np.nan
df.style.set_na_rep('MISS').set_precision(1)
MISS | 2
3.0 | 4
df.style.set_na_rep('MISS').format('{:,.1f}')
nan | 2.0
3.0 | 4.0
df.style.set_na_rep('MISS').format('{:,.1f}', na_rep='PASS')
PASS | 2.0
3.0 | 4.0
could probably do with a review how the attribute na_rep interacts with the formatter and try to make it more dynamic or use pointers instead of static value, if possible.