일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- hive
- list
- array
- c#
- 파이썬
- Google Excel
- Apache
- Kotlin
- Excel
- Tkinter
- Redshift
- Github
- dataframe
- matplotlib
- PostgreSQL
- Google Spreadsheet
- SQL
- PySpark
- math
- string
- PANDAS
- Java
- GIT
- numpy
- Python
- gas
- Mac
- google apps script
- django
- Today
- Total
목록Python (384)
달나라 노트
Pandas의 columns는 DataFrame에 존재하는 Column의 정보를 출력해줍니다. import pandas as pddict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': [2, 3, 4, 5, 6],}df_test = pd.DataFrame(dict_test)print(df_test)print(df_test.columns)-- Result col1 col20 1 21 2 32 3 43 4 54 5 6Index(['col1', 'col2'], dtype='object') list() method를 이용해서 column을 list의 형태로 만들 수도 있습니다. import ..
WEB을 다루다 보면 API를 호출해서 데이터를 불러올 때가 있는데 이때 아래처럼 내가 받은 데이터가 깨져 보일 때가 있습니다. 이를 해결할 수 있는 두 가지 방법을 봐보겠습니다. 첫 번째 방법입니다. b'\xc2\xd4\xb5\xa0/\xc6\xdf\xb2\xe2\xb0\xb6\xba\xb5' 맨 앞에 b가 붙었다는 것은 바이트(byte) type의 데이터라는 의미입니다. Encoding을 바꿔주면 해결할 수 있습니다. import requestsurl = 'https://apihub.kma.go.kr/api/typ01/url/fct_afs_wl.php'params = { 'tmfc1': '2024042200', 'tmfc2': '2024042223', 'mode': '0', ..

matplotlib의 arrow method는 좌표평면에 화살표를 그릴 수 있도록 해줍니다. import matplotlib.pyplot as plt plt.arrow( x=1, y=1, # 화살표 시작 지점의 x, y 좌표 (화살표 tail의 x, y 좌표) dx=2.5, dy=0.3, # 화살표 시작 지점 으로부터 x축으로 얼마, y축으로 얼마나 이동한 화살표를 그릴지를 의미 width=0.01, # 화살표 두께 length_includes_head=True, # 화살표 길이를 잴 때 head의 길이도 포함할지 여부 (True = 화살표 head 길이도 화살표 전체 길이에 포함하여 고려) head_width=0.03, # 화살표 head의 두께 head_length=0.1, # 화살표 head의 길이..

matplotlib의 bar method를 가지고 stacked bar graph를 그릴 수 있습니다. (bar method = https://cosmosproject.tistory.com/427) import matplotlib.pyplot as plt import numpy as np arr_bottom = np.array([0, 0, 0, 0]) list_x = ['2021', '2022', '2023', '2024'] arr_row_1 = np.array([34, 86, 94, 20]) arr_row_2 = np.array([59, 4, 98, 93]) plt.bar(list_x, arr_row_1, bottom=arr_bottom, width=0.5, color='pink') arr_bottom..