I have a very large matrix of 100K x 100K and to manage memory better, I am setting this as a dataframe with int8 as datatype (for 1 byte per cell). However, it gets set as a float with 8 bytes per cell. Where am I going wrong?
df = pd.DataFrame()
df=df.astype('int8')
mat_len=100,000
for i in range(0, mat_len):
new_row = pd.Series([0] * mat_len)
df = df.append(new_row, ignore_index='True') #initializing matrix
for i in range(0, mat_len):
for j in range(i,mat_len):
df.iloc[i,j] = i+j #simplified calc for testing purposes
print(df.info())
output: dtypes: float64(100)