为什么要更改我的数据的类型并不会减少我的镶木质量的大小?

发布于 2025-02-06 15:49:38 字数 774 浏览 1 评论 0原文

我正在进行一些实验,以减少镶木木的大小。 我想在每列中带有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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文