为什么要更改我的数据的类型并不会减少我的镶木质量的大小?
我正在进行一些实验,以减少镶木木的大小。 我想在每列中带有NAN类型的6列,我想将其导出到Parquet中。带有float64格式的列出口后的镶木quet文件的大小为23555kb。
第一个实验将列转换为float32,我的大小与镶木quet相同。
df[list_column]=df[list_column].astype('Float32')
df[list_column].to_parquet("Float32.parquet")
第二个实验将列转换为INT64相同结果。
df[list_column]=df[list_column].astype('Int64')
df[list_column].to_parquet("Int64.parquet")
第三个实验用-999填充了NAN,然后转换为INT16,我得到了一个尺寸为23980kb的木板文件。
df[list_column]=df[list_column].fillna(-999)
df[list_column]=df[list_column].astype('Int16')
df[list_column].to_parquet("Int16.parquet")
我不明白为什么在将我的float64列转换为较小的格式后,我的尺寸相同,甚至更大的INT16。 结果
I'm running some experimentations to reduce the size of my parquet files.
I have a 6 columns in type float64 with nan in each column that I want to export into parquet. The parquet file after exportation with the columns with the float64 format has a size of 23555KB.
First experimentation converting the columns into float32 I got the same size 23555KB for the parquet.
df[list_column]=df[list_column].astype('Float32')
df[list_column].to_parquet("Float32.parquet")
Second experimentation converting the columns into int64 same result.
df[list_column]=df[list_column].astype('Int64')
df[list_column].to_parquet("Int64.parquet")
Third experimentation fill the nan with -999 and convert into int16 I got a parquet file with a size 23980KB.
df[list_column]=df[list_column].fillna(-999)
df[list_column]=df[list_column].astype('Int16')
df[list_column].to_parquet("Int16.parquet")
I don't understand why after converting my float64 columns into smaller format I got parquet with the same size or even bigger for the int16.
result
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论