일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Python
- Tkinter
- hive
- dataframe
- Excel
- google apps script
- PANDAS
- 파이썬
- Java
- matplotlib
- array
- c#
- Redshift
- list
- string
- numpy
- PostgreSQL
- GIT
- Google Excel
- math
- Kotlin
- Mac
- django
- SQL
- Google Spreadsheet
- Github
- PySpark
- gas
- Apache
- Today
- Total
목록Python (384)
달나라 노트
Python library중 하나인 sys의 path는 환경 변수(PYTHONPATH)의 list를 출력해줍니다. import sys print(sys.path) -- Result [ '/Users/Documents/Code', '/Users/Documents/Code/temporary', '/Users/.conda/envs/customs', '/Users/.conda/envs/customs/lib/python3.8', '/Users/.conda/envs/customs/lib/python3.8/lib-dynload', '/Users/.conda/envs/customs/lib/python3.8/site-packages' ] sys.path를 이용해서 그 내용을 출력해보면 위같이 여러 경로가 list에 담긴..
일반적으로 pandas의 groupby를 이용하면 한번에 하나의 aggregate function밖에 사용할 수 없습니다. import pandas as pd dict_item = { 'date': [ 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200104 ], 'item_id': [ 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4 ], 'item_name': [ 'a', 'a', 'a', 'b', 'b', 'b', 'c', 'c', 'c', 'd', 'd', 'd', 'd' ], 'price': [ 1000, ..
transform method는 DataFrame에서 groupby로 집계한 결과를 동일한 index를 가진 행에 넣어서 return해줍니다.말만 들으면 무슨 소린지 잘 감이 오지 않는데 실제 예시를 봅시다. import pandas as pddict_item = { 'date': [ 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200101, 20200102, 20200103, 20200104 ], 'item_id': [ 1, 1, 1, 2, 2, 2, 3, 3, 3, 4..

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:..