NumPy 정수형 값 범위

1 개요[ | ]

NumPy 정수형 값 범위
Pandas 정수형 값 범위
import numpy as np
import pandas as pd
import re
lst = []
for x in dir(np):
  if re.match('u?int[1-8]+$', x):
    lst.append({'dtype':x, 'min':np.iinfo(x).min, 'max':np.iinfo(x).max})
pd.DataFrame(lst).sort_values(by=['max'])
import numpy as np
import pandas as pd
columns = ['int8','uint8','int16','uint16','int32','uint32','int64','uint64']
df = pd.DataFrame(np.array([(0,0,0,0,0,0,0,0)], dtype=[(x, getattr(np,x)) for x in columns]))
lst = []
for i in range(8):
  lst.append([columns[i], df.memory_usage()[i+1], np.iinfo(columns[i]).min, np.iinfo(columns[i]).max])
pd.DataFrame(lst,columns=['dtype','memory','min','max'])

2 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}