我想知道如何使用“ pkl”和“ npz” python中的文件。我只能从他们那里得到str

发布于 2025-02-04 18:50:33 字数 806 浏览 4 评论 0原文

我需要IMU数据集,所以我从以下 https://dip.is.tuebingen.mpg.de/

文件是“ pkl“或“ npz”。因此,我寻找如何将其加载到Python中。 但是,我只能看到一个包含一些“ str”贵重物品的“列表”。 我希望我会得到一些对象,但只有几个字符串,似乎也不是数据。

with np.load("imu_own_test.npz") as f:
    file_list = f.files
    for item in file_list:
        print(type(item))

因此,我也尝试编码,因为“ str”似乎不是正确的字符类型。 但是,没有工作。 我只能看到这些字符。 “ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ x00 \ xfa〜j \ xbct \ x93 \ x93 \ x98? XBF \ XFC \ XA9 \ XF1 \ XD2MBP?B \ XCFF \ XD5 \ XE7J \ X“

with open('01.pkl', 'r') as source_file:
    with open('02.csv', 'w+b') as dest_file:
        contents = source_file.read()
        dest_file.write(contents.encode('utf-16'))

我如何使用它?

I need IMU dataset, So I have downloaded it from the following
https://dip.is.tuebingen.mpg.de/

The files are either "pkl" or "npz". So I looked for how to load it in python.
however, I can see only a "list" that contained a few "str" valuables.
I expected I would get some objects but it had only a few strings, also can't seem to be data.

with np.load("imu_own_test.npz") as f:
    file_list = f.files
    for item in file_list:
        print(type(item))

So I also tried encoding, because the "str" didn't seem to be the proper type of character.
But, didn't work.
I can see only these characters.
"x00\x00\x00\x00\x00\x00\xfa~j\xbct\x93\x98?B>\xe8\xd9\xac\xfa\xac\xbf\xb8\x1e\x85\xebQ\xb8\xae\xbf\xfc\xa9\xf1\xd2Mbp?B\xcff\xd5\xe7j\x"

with open('01.pkl', 'r') as source_file:
    with open('02.csv', 'w+b') as dest_file:
        contents = source_file.read()
        dest_file.write(contents.encode('utf-16'))

How can I use it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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