일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- gas
- Excel
- string
- list
- math
- Python
- SQL
- matplotlib
- Github
- django
- PANDAS
- Apache
- Tkinter
- Java
- array
- Redshift
- 파이썬
- dataframe
- PySpark
- PostgreSQL
- Google Spreadsheet
- hive
- Kotlin
- google apps script
- c#
- GIT
- Mac
- numpy
- Google Excel
- Today
- Total
목록BytesIO (3)
달나라 노트
openpyxl이라는 라이브러리는 Python에서 Excel을 다룰 수 있게 해주는 기능을 가지고 있습니다. pandas에서도 read_excel() method를 사용할 때 등 openpyxl을 아주 밀접하게 사용하고있습니다. 이렇게 일반적으로 openpyxl은 다른 라이브러리 내부에서 엔진으로서 사용되고 있어서 이것을 직접 사용하는 경우는 아주 많지는 않을 수 있습니다만 그래도 엑셀 데이터를 다룰 수 있게 해주는 강력한 툴 중 하나이므로 그 방법을 알아봅시다. import pandas as pd import io df_test_1 = pd.DataFrame({ 'item_id': [1, 2, 3, 4, 5], 'name': ['a', 'b', 'c', 'd', 'e'] }) df_test_2 = pd..
DataFrame을 xlsx 파일로 생성하려면 to_excel() method를 사용합니다. import pandas as pd df_test = pd.DataFrame({ 'item_id': [1, 2, 3, 4, 5], 'name': ['a', 'b', 'c', 'd', 'e'] }) print(df_test) dir = 'output/df_test.xlsx' df_test.to_excel(dir, index=False, sheet_name='test') 이런 식이죠. 이렇게 하면 제가 지정한 'output/df_test.xlsx'라는 경로에 파일이 생성됩니다. import pandas as pd df_test_1 = pd.DataFrame({ 'item_id': [1, 2, 3, 4, 5], 'na..
requests library와 API를 이용하다보면 csv format의 데이터를 얻어올 때가 있습니다. 그 결과값은 API를 어떻게 만드냐에 따라 달라질 수 있지만 주로 보이는 형태는 아래와 같습니다. import requests api_endpoint = 'https://test_api/get_data' response = requests.get(api_endpoint) print(response.status_code) print(response.content) print(type(response.content)) -- Result 200 b'modelno,name,price,weight\r\nAGH1341,Laptop,1300000,1200\r\nSOE1029,Desktop,1800000,3500..