일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Google Excel
- 파이썬
- Redshift
- GIT
- google apps script
- Python
- matplotlib
- numpy
- list
- Google Spreadsheet
- Mac
- hive
- dataframe
- Excel
- Kotlin
- Java
- SQL
- string
- math
- PostgreSQL
- c#
- PySpark
- Apache
- Github
- array
- PANDAS
- gas
- django
- Tkinter
- Today
- Total
목록Dictionary (13)
달나라 노트
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개 만큼..
GAS에서는 객체라는 것이 있습니다. 마찬가지로 여러 데이터를 하나로 묶어서 다루는 방식이며 python의 dictionary와 매우 유사하다고 생각하면 편합니다. function myFunction() { var animal = { 'name': 'cat', 'color': 'white', 'age': 3 }; console.log(animal['name']); console.log(animal['color']); console.log(animal['age']); } -- Result cat white 3 위 코드는 animal이라는 변수에 객체를 할당한 코드입니다. var animal = { 'name': 'cat', 'color': 'white', 'age': 3 }; 객체 선언 부분을 봅시다. 일..