我正在使用numpy并希望索引一行而不会丢失维度信息.
import numpy as np
X = np.zeros((100,10))
X.shape # >> (100, 10)
xslice = X[10,:]
xslice.shape # >> (10,)
Run Code Online (Sandbox Code Playgroud)
在这个例子中,xslice现在是1维,但我希望它是(1,10).在R中,我会使用X [10,:,drop = F].numpy中有类似的东西吗?我在文档中找不到它,也没有看到类似的问题.
谢谢!
I'm trying to compile Vim 7.2 with Python 2.5.1 support, but I'm having some trouble.
I run configure which seems like it is working as expected
./configure --with-features=huge --enable-pythoninterp --prefix=/home/username/vimpy
Run Code Online (Sandbox Code Playgroud)
I can see that changes to --with-features works as I expect (the final compiled version has new features), and it sets up Python correctly
checking for python... (cached) //python/2.5/bin/python checking Python version... (cached) 2.5 checking Python is 1.4 or better... yep checking Python's install prefix... (cached) //python/2.5 checking Python's execution …