반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- PySpark
- string
- array
- GIT
- Kotlin
- matplotlib
- Python
- numpy
- PostgreSQL
- Redshift
- gas
- Google Excel
- dataframe
- google apps script
- list
- hive
- c#
- 파이썬
- Tkinter
- Github
- Mac
- math
- django
- Apache
- Java
- Excel
- SQL
- Google Spreadsheet
- PANDAS
Archives
- Today
- Total
목록F (1)
달나라 노트
Python Basic : format (천단위 콤마 삽입하기)
숫자가 1000, 10000단위 이상으로 커지게 되면 천단위 콤마를 찍어주는게 가독성이 좋습니다. 이런저런 로직을 넣어서 직접 python 함수를 만들 수도 있겠지만, 굳이 이런 번거로운 일을 할 필요 없이 Python에서는 format이라는 함수를 제공합니다. Syntax format(number, ',d/f') number --> format을 적용하여 천단위 콤마를 찍을 숫자입니다. ',d/f' --> format을 적용할때 받은 number의 자료형이 무엇인지 입력하고 천단위 콤마를 찍는다는 의미입니다. d는 정수이고, f는 실수입니다. 예시를 보시죠. print(format(12345678910, ',d')) # 1. 12,345,678,910 print(format(12345678910, ',..
Python/Python Basic
2021. 9. 7. 00:08