일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- hive
- c#
- GIT
- PANDAS
- Github
- Kotlin
- SQL
- Python
- list
- django
- gas
- Mac
- Apache
- PySpark
- dataframe
- Google Spreadsheet
- google apps script
- Java
- Tkinter
- math
- PostgreSQL
- array
- 파이썬
- Excel
- string
- Google Excel
- Redshift
- matplotlib
- numpy
- Today
- Total
목록shape (2)
달나라 노트
import numpy as np arr_test = np.array( [ # 1차 array [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5] # 2차 array ] ) print(arr_test) print(arr_test.size) print(arr_test.shape) -- Result [[1 2 3 4 5] [1 2 3 4 5] [1 2 3 4 5]] 15 (3, 5) 위 예시를 봅시다. 2차원 array를 만들고 size와 shape attribute를 적용시켰습니다. size attribute는 array에 존재하는 모든 요소의 개수를 알려줍니다. 위 예시의 array는 5개의 요소를 가진 array가 총 3개 들어있는 2차원 array입니다. 이것을 ..
pandas의 shape은 DataFrame에 적용해서 해당 DataFramedml 행/열(row/column) 개수를 tuple의 형태로 반환해줍니다. shape의 syntax는 다음과 같습니다. DataFrame.shape import pandas as pd dict_test = { 'col1': [1, 2, 3, 4, 5], 'col2': ['a', 'b', 'c', 'd', 'e'], 'col3': [6, 7, 8, 9, 10] } df_test = pd.DataFrame(dict_test) print(df_test) print(df_test.shape) -- Result col1 col2 col3 0 1 a 6 1 2 b 7 2 3 c 8 3 4 d 9 4 5 e 10 (5, 3) 위 예시를 보..