일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 |
31 |
- PANDAS
- hive
- Google Spreadsheet
- SQL
- math
- gas
- c#
- Excel
- 파이썬
- dataframe
- Mac
- matplotlib
- django
- Kotlin
- Redshift
- Java
- list
- Tkinter
- string
- Apache
- PostgreSQL
- Github
- Google Excel
- array
- Python
- PySpark
- numpy
- GIT
- google apps script
- Today
- Total
목록Python (384)
달나라 노트
pandas의 to_json() method는 DataFrame을 json 파일로 생성해주는 기능을 가집니다. Syntax DataFrame.to_json(file_name, orient) - file_name 생성할 json 파일의 이름을 적습니다. json 파일은 test_file.json 처럼 json이라는 확장자를 갖습니다. - orient 생성할 json 파일의 format을 의미합니다. columns, index, records, values, split의 다섯 종류가 있습니다. 각각의 orient 값이 어떤 형태를 의미하는지는 예시를 통해 알아봅시다. import pandas as pd dict_test = { 'name': ['apple', 'banana', 'peach'], 'price'..
math library의 modf() method는 어떤 실수의 정수부, 소수부를 tuple에 묶어서 return합니다. Syntax math.modf(x) x는 어떤 숫자입니다. x의 정수부와 소수부를 나눠서 하나의 tuple에 묶어서 return해줍니다. 예시를 봅시다. import math print(math.modf(10.33)) print(math.modf(10.723)) -- Result (0.33, 10.0) (0.723, 10.0) - math.modf(10.33) 10.33의 정수부는 10이고, 소수부는 0.33입니다. 따라서 (실수부, 정수부) 이렇게 각각을 하나의 tuple로 묶어서 return합니다. 결과를 보면 (0.33, 10.0) 입니다. - math.modf(10.723) 1..
math library의 factorial() method는 특정 숫자의 factorial 값을 return합니다. Syntax math.factorial(x) x는 숫자입니다. 전달받은 x의 팩토리얼 값을 return합니다. 팩토리얼 값을 계산하기 때문에 x는 양의 정수만을 받습니다. (실수, 음수 등을 전달하면 error가 발생합니다.) 예시를 봅시다. import math print(math.factorial(5)) -- Result 120 - math.factorial(5) 5!의 값을 계산하여 return합니다. 5! = 5 * 4 * 3 * 2 * 1 = 120 이므로 120이 return됩니다.
math library의 sqrt() method는 제곱근 값을 return합니다. Syntax math.sqrt(x) x는 어떤 숫자입니다. sqrt() method는 x의 제곱근 값을 return합니다. 예시를 봅시다. import math print(math.sqrt(16)) print(math.sqrt(64)) -- Result 4.0 8.0 - math.sqrt(16) 16의 제곱근은 4이므로 4가 return됩니다. - math.sqrt(64) 64의 제곱근은 8이므로 8이 return됩니다. return값을 보면 4.0, 8.0의 float type입니다. sqrt() method는 float type의 값을 결과로 return합니다.