| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- GIT
- c#
- gas
- math
- PANDAS
- Apache
- Kotlin
- PostgreSQL
- Google Excel
- hive
- string
- PySpark
- django
- Python
- Github
- google apps script
- numpy
- matplotlib
- Java
- dataframe
- SQL
- Excel
- Redshift
- 파이썬
- array
- Mac
- Google Spreadsheet
- Tkinter
- list
- Today
- Total
목록values (3)
달나라 노트
Pandas Series .values vs .to_numpy() 둘 다 Series를 numpy array로 변환하지만, .values는 dtype에 따라 동작이 달라지고 원본을 건드릴 위험이 있습니다. .to_numpy()가 현재 권장 방식입니다. 기본 사용 결과는 같아 보입니다. 차이는 dtype이 복잡해질 때 드러납니다. import pandas as pds = pd.Series([10, 20, 30])s.values # array([10, 20, 30])s.to_numpy() # array([10, 20, 30]) 차이 1 — 반환 타입이 dtype에 따라 달라진다 .values는 Series 내부 저장 방식에 따라 반환 타입이 달라집니다. # 일반 dtype → nu..
Syntax dictionary.keys() dictionary에 존재하는 모든 key를 return 합니다. dictionary.values() dictionary에 존재하는 모든 value를 return 합니다. dictionary.items() dictionary를 구성하는 모든 key, value 값을 tuple로 묶어서 return 합니다. 예시를 봅시다. dict_test = { 'key1': 1, 'key2': 2, 'key3': 3 } print(dict_test.keys()) -- Result dict_keys(['key1', 'key2', 'key3']) - dict_test.keys() dict_test에 keys() method를 적용했습니다. 그 결과 값을 보니 dict_keys(..
pandas의 values는 DataFrame에 적용하여 해당 DataFrame을 numpy arrary의 형태로 변환해줍니다. 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.values) -- Result col1 col2 col3 0 1 a 6 1 2 b 7 2 3 c 8 3 4 d 9 4 5 e 10 [[1 'a' 6] [2 'b' 7] [3 'c' 8] [4 'd' 9] [5 'e' 10]] 위 예시를 보면 Test용 ..