gpt4 book ai didi

python - Linux 和 Windows 中的 .values() 有区别吗?

转载 作者:太空宇宙 更新时间:2023-11-04 05:40:57 25 4
gpt4 key购买 nike

我在我的Windows计算机上编写了一些代码,并将其转移到Linux系统上。他们都有 python3 并且应该有相同的库。然而,虽然我的脚本在 Windows 中运行良好,但在 Linux 上却收到错误消息。

这是导致问题的代码部分:

Normalized=(Combined/Dilutions.values)
#where
print(Combined)
Column_4 Column_4 Column_4 Column_4 Column_4 Column_4
2 50034 50034 32355 21058 10457 0
3 38230 38230 31054 18963 11770 0
4 34503 34503 22208 14216 5492 0
5 34219 34219 22975 11450 4148 0
6 37442 37442 25319 16206 7369 0
7 32144 32144 21293 14307 5594 0
8 28053 28053 19972 10767 4448 2634
9 30395 30395 22899 10458 4967 0

#and
print (Dilution)
0 1 2 3 4 5
0 103000.0 103000.0 95000.0 79600.0 78100.0 74562

当然,虽然这些大小不同,但我可以将稀释值划分到组合中的每一行上。不过,我似乎无法在 Linux 中执行此操作,运行此命令会给我这个。

Traceback (most recent call last):
File "blue.py", line 61, in <module>
Normalized=(Combined/Dilutions.values)
File "/usr/lib/python3/dist-packages/pandas/core/ops.py", line 1257, in f
other = _align_method_FRAME(self, other, axis)
File "/usr/lib/python3/dist-packages/pandas/core/ops.py", line 1180, in _align_method_FRAME
raise ValueError(msg)
ValueError: Unable to coerce to DataFrame, shape must be (8, 6): given (1, 6)

是否有我在 Linux 中缺少的软件包在 Windows 中也有?否则我不知道为什么它可以在一个操作系统上运行,但不能在另一个操作系统上运行。

最佳答案

您可以在每个系统上尝试 pip freeze 来确认每个系统上安装了哪些软件包和版本。为了获得更多控制,您可以在 Windows 和 Linux 上安装 Anaconda,然后您可以管理每个包的特定版本...包括 Python 本身。

当您使用不同大小的数据帧(或 Numpy 数组)时,您不应该通过广播来覆盖大小差异吗?

关于python - Linux 和 Windows 中的 .values() 有区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59441247/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com