新的python,并尝试安装模块"apiclient",因为我的ide pycharm无法识别导入:
from apiclient.discovery import build
Run Code Online (Sandbox Code Playgroud)
我试过的:
https://developers.google.com/api-client-library/python/start/installation#system-requirements 然后我将其解压缩到
/Users/nirregev/anaconda/bin/google-api-python-client-1.5.0
Run Code Online (Sandbox Code Playgroud)
并在我的mac终端python setup.py安装上运行它,但仍然pycharm无法识别此模块.根据pycharm我安装了以下解释器:
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
/Users/nirregev/anaconda/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Run Code Online (Sandbox Code Playgroud) 我有一个数值列表,我需要计算一个新列表,该列表将由原始列表中每两个连续元素的差值组成。我有这个代码:
wss <- (nrow(dat)-1)*sum(apply(dat,2,var))
for (i in 2:15) wss[i] <- sum(kmeans(dat,
centers=i)$withinss)
plot(1:15, wss, type="b", xlab="Number of Clusters",
ylab="Within groups sum of squares")
# choose optimal k where sos derivative is large for the first time
diff <- lapply(wss, diff)
Run Code Online (Sandbox Code Playgroud)
所以我原来的列表是 wss
> dput(wss)
c(4155212952468.46, 4021505707879.36, 4017356406677.14, 4015231535838.63,
4013350949497.91, 17067610483.738, 17023281391.9182, 4013258218594.64,
14454798910.9291, 16989216167.6064, 14860266330.575, 14480295584.8302,
14506662229.3596, 14289181733.1553, 14283121461.9347)
Run Code Online (Sandbox Code Playgroud)
在结果列表中,我预计第一个元素将是 4155212952468.46 - 4021505707879.36 第二个元素将是 4021505707879.36 - 4017356406677.14 等等任何帮助表示赞赏