티스토리 뷰
SMALL
- 상황 : pandas dataframe의 용량이 커서 그런지, 데이터 가공 코드를 실행할 때마다 시간이 오래 걸림.
- 실제 문제 해결 방법
- pandas dataframe은 default로 64bit의 데이터타입들을 활용함 (예: float64, int64)
- 데이터 범위에 맞춰서 줄여서 메모리 크기를 대폭 줄임
import numpy as np
data['column'] = data['column'].astype(np.int32)
- 참고 자료
- 아래 범위에 맞게 적절한 데이터 타입 선정 후 타입 변경 추천
Data type | Description |
bool_ | Boolean (True or False) stored as a byte |
int_ | Default integer type (same as C long; normally either int64 or int32) |
intc | Identical to C int (normally int32 or int64) |
intp | Integer used for indexing (same as C ssize_t; normally either int32 or int64) |
int8 | Byte (-128 to 127) |
int16 | Integer (-32768 to 32767) |
int32 | Integer (-2147483648 to 2147483647) |
int64 | Integer (-9223372036854775808 to 9223372036854775807) |
uint8 | Unsigned integer (0 to 255) |
uint16 | Unsigned integer (0 to 65535) |
uint32 | Unsigned integer (0 to 4294967295) |
uint64 | Unsigned integer (0 to 18446744073709551615) |
float_ | Shorthand for float64. |
float16 | Half precision float: sign bit, 5 bits exponent, 10 bits mantissa |
float32 | Single precision float: sign bit, 8 bits exponent, 23 bits mantissa |
float64 | Double precision float: sign bit, 11 bits exponent, 52 bits mantissa |
complex_ | Shorthand for complex128. |
complex64 | Complex number, represented by two 32-bit floats |
complex128 | Complex number, represented by two 64-bit floats |
반응형
'Python' 카테고리의 다른 글
[Error Handling] Cuda out of memory 해결 (1) | 2021.03.18 |
---|---|
영어 자연어 처리를 위한 Tokenization하기 (0) | 2020.12.08 |
Jupyter Notebook 활용하여 데이터 불러오기 (0) | 2020.12.01 |
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 데이터프레임사이즈
- 파이썬
- 데이터프레임메모리
- dag실패
- rustwindow
- python
- rust설치하는방법
- 사당맛집
- 곱창
- rust설치방법
- 데이터프레임용량
- 빅데이터
- DB
- rust공부
- pandas데이터프레임
- windows에서rust설치
- rust설치
- 맛집
- nosql
- 대창
- task실행
- 데이터베이스
- 곱창맛집
- pandas
- 막창
- task실패
- windowrust
- 사당역맛집
- rust스터디
- 배치실패
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함