小编Sha*_*awn的帖子

Anaconda Navigator - 遇到多个错误

我最近使用以下命令破坏了 Anaconda Navigator 的安装:

conda update --all -y
Run Code Online (Sandbox Code Playgroud)

显然,这并不少见,这是重新安装 Anaconda 并从头开始新环境的好借口。

但是,在尝试安装任何库时,我的新安装会出现以下错误:

遇到多个错误

我试过了:

  • Windows 卸载 Anaconda,然后重新启动,然后重新安装
  • 以管理员身份卸载/重启/安装
  • 卸载/重新启动/手动删除用户目录中的各种剩余文件夹/重新启动/重新安装
  • 等等等等

尝试安装库时,所有这些方法都会产生此错误。

  • 使用 Anaconda 控制台安装库工作正常
  • Windows 的 PATH 中没有任何问题
  • conda 是最新的

这是怎么回事!?

anaconda

10
推荐指数
2
解决办法
2万
查看次数

如何使用 numpy 正确屏蔽 3D 数组

我正在尝试使用 numpy 来屏蔽 3D 数组(RGB 图像)。

但是,我目前的方法是重塑屏蔽数组(下面的输出)。我试图遵循 SciKit-Image 速成课程中描述的方法。 速成班

我查看了 Stackoverflow 并提出了类似的问题,但没有接受的答案(这里有类似的问题)

完成这样的掩蔽的最佳方法是什么?

这是我的尝试:

# create some random numbers to fill array
tmp = np.random.random((10, 10))

# create a 3D array to be masked
a = np.dstack((tmp, tmp, tmp))

# create a boolean mask of zeros
mask = np.zeros_like(a, bool)

# set a few values in the mask to true
mask[1:5,0,0] = 1
mask[1:5,0,1] = 1

# Try to mask the original array
masked_array = a[:,:,:][mask == 1] …
Run Code Online (Sandbox Code Playgroud)

python numpy scikit-image

6
推荐指数
1
解决办法
1万
查看次数

使用Pandas中的列表替换列名称

在熊猫中使用df.rename时,我试图理解我的错误.具体来说,使用带有元组的重命名函数可以无错误地执行,但不会对列名进行任何更改.

f_GreaterArea = pd.DataFrame(np.random.randn(5, 3), 
                index=['a', 'c', 'e', 'f', 'h'],
                columns=['one', 'two', 'three'])

print(f_GreaterArea)

    one       two     three
a  0.278969 -0.676388 -2.464444
c -0.992077 -0.435534  2.267315
e  2.094669 -1.401885  1.243658
f  0.886835  0.195726 -0.132382
h -0.920486 -0.298380  2.227378

old_colnames = ('one', 'two', 'three')
new_colnames = ('pig', 'cups', 'seven')


f_GreaterArea.rename(columns={old_colnames:new_colnames}, inplace=True)

print(f_GreaterArea)

    one       two     three
a  0.278969 -0.676388 -2.464444
c -0.992077 -0.435534  2.267315
e  2.094669 -1.401885  1.243658
f  0.886835  0.195726 -0.132382
h -0.920486 -0.298380  2.227378
Run Code Online (Sandbox Code Playgroud)

python pandas

4
推荐指数
2
解决办法
4595
查看次数

标签 统计

python ×2

anaconda ×1

numpy ×1

pandas ×1

scikit-image ×1