일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- string
- Google Excel
- django
- list
- Tkinter
- Apache
- numpy
- PANDAS
- Java
- Kotlin
- Google Spreadsheet
- Mac
- PySpark
- Redshift
- math
- hive
- Python
- PostgreSQL
- Excel
- c#
- SQL
- google apps script
- dataframe
- matplotlib
- Github
- gas
- 파이썬
- array
- GIT
- Today
- Total
목록JSON (6)
달나라 노트
Redshift에서 json_extract_path_text() 함수를 사용하면 JSON 형태로 존재하는 text를 JSON을 다루듯이 사용할 수 있습니다. Syntax json_extract_path_text(json_text, key1, key2, ...) 사용법은 위와 같습니다. 첫 번째 인자로 JSON 형태의 텍스트를 받습니다. 그리고 두번째부터는 JSON에 있는 key값을 적어주면 됩니다. select '{"apple": 20000, "banana": 8000, "peach": 22000}' as json_string , json_extract_path_text(json_string, 'apple') --> 20000 , json_extract_path_text(json_string, 'bana..

dictionary를 JSON data로 바꾸고 .json 파일을 생성해봅시다. - 참고 = dictionary json 변환 https://cosmosproject.tistory.com/758 import json dict_data = { "category": "fruits", "product_cnt": 2, "product": { "Apple": { "price": 20000, "weight": 3 }, "Watermelon": { "price": 18000, "screen_size": 2 }, } } json_data = json.dumps(dict_data) print(json_data) print(type(json_data)) with open('json_data.json', 'w') as f:..
JSON (JavaScript Object Notation) 데이터는 프로그래밍에서 자주 쓰이는 형태의 데이터입니다. 다양한 정보를 보고 다루기 쉽게 저장할 수 있죠. 기본적으로 JSON data는 Python의 dictionary type과 매우 유사합니다. Python의 dictionary를 JSON 형태의 string으로 변환하기 위해서는 json library의 dumps method를 사용하면 됩니다. Syntax json.dumps(dictionary, indent=n) - dictionary JSON 형태의 string으로 변환할 dictionary 입니다. - indent = n optional한 parameter입니다. 명시하지 않아도 되며 명시할 경우 출력할 때 더 보기 쉽게 n개 만큼..
pandas의 read_json() method는 json 파일을 읽어와서 DataFrame으로 변환해주는 기능을 합니다. Syntax pandas.read_json(json_file, orient) - json_file 읽어올 json 파일의 경로와 이름입니다. (경로는 상대경로, 절대경로 모두 가능합니다.) - orient json 파일의 format입니다. columns, index, records, values, split의 다섯 종류가 있습니다. 각 orient 값이 어떠한 json format을 의미하는지는 본 글의 아래 부분에서 다루겠습니다. (format에 대한 자세한 설명은 다음 링크를 참고하시면 좋습니다. https://cosmosproject.tistory.com/684) fruits..