일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Apache
- Redshift
- gas
- string
- SQL
- Google Spreadsheet
- Github
- matplotlib
- Python
- list
- Java
- dataframe
- PANDAS
- django
- Kotlin
- c#
- array
- Google Excel
- math
- PySpark
- GIT
- hive
- Mac
- 파이썬
- PostgreSQL
- Excel
- google apps script
- Tkinter
- numpy
- Today
- Total
목록to_json (2)
달나라 노트
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'..
Python Pandas에는 DataFrame이나 Series를 json 형태로 변환해주는 to_json이라는 method가 있습니다. 예시를 보시죠. import pandas as pd dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': ['a', 'b', 'c', 'd', 'e'], 'col3': ['Apple', 'Banana', 'Watermelon', 'Grape', 'Melon'] } df_test = pd.DataFrame(dict_test) print(df_test) json_test = df_test.to_json() print(json_test) -- Result col1 col2 col3 0 1 a Apple 1 2 b Banana 2 3 c Water..