728x90
df.style.format(precision=0, na_rep='MISSING', thousands=",",
formatter={('pct'): "{:.1%}",
('Regression', 'Non-Tumour'): lambda x: "$ {:,.1f}".format(x*-1e6)
})
https://pandas.pydata.org/pandas-docs/stable/user_guide/style.html
728x90
'파이썬(Python) > Pandas' 카테고리의 다른 글
Pandas code snippet (1) | 2023.12.05 |
---|---|
Dataframe의 컬럼별 포멧 정의하기 (0) | 2022.01.17 |
pandas에서 모든 행 보여주기 (0) | 2022.01.14 |
pandas에서 describe() 사용하면 전체 숫자가 안나올 때 (0) | 2021.03.17 |
python에서 pandas dataframe에서 컬럼의 text가 모두 안보이는 경우 (0) | 2021.03.12 |