是否可以使用gspreadGoogle Spreadsheets或其他基于Python的访问权限将图像插入电子表格?
此外,是否可以制作丰富的文本单元格(例如,粗体,斜体,不同的字体大小,颜色等)?
如果我有中等数量的基本特征并从中生成中等阶数的多项式特征,那么弄不清楚特征数组的哪一列preprocess_XX对应于基本特征的哪种转换可能会引起混淆。
我以前使用sklearn的旧版本(也许是0.14?)执行以下操作:
import numpy as np
from sympy import Symbol
from sklearn.preprocessing import PolynomialFeatures
poly = PolynomialFeatures(4)
x1 = Symbol('x1')
x2 = Symbol('x2')
x3 = Symbol('x3')
XX = np.random.rand(1000, 3) # replace with the actual data array
preprocess_symXX = poly.fit_transform([x1, x2, x3])
preprocess_XX = poly.fit_transform(XX)
print preprocess_symXX
Run Code Online (Sandbox Code Playgroud)
太棒了 它会产生类似的输出[1, x1, x2, x3, x1**2, ... ],这会让我知道列的preprocess_XX实际多项式函数来自哪里。
但是现在,当我这样做时,它会抱怨TypeError: can't convert expression to float。引发此异常的原因是sklearn.utils.validation调用了一个函数check_array(),该函数试图将输入转换poly.fit_transform()为dtype=float。
您是否有建议,如何看待基本特征的多项式与输出中的哪一列相对应,而fit_transform()?现在 …
例如,如果我这样做:
import numpy as np
import pylab as plt
x = np.linspace(0,10)
y = x**2
z = 50*np.sin(x)
plt.plot(x,y)
plt.fill_between(x,z,facecolor='r')
plt.show()
Run Code Online (Sandbox Code Playgroud)
然后在阴影区域下方仍然可以看到线图.有没有办法让阴影区域完全阻挡它下面的东西?
谢谢.
通过以下内容,我可以以编程方式在 Google 表格中创建电子表格,但该表格的所有者是开发者帐户(一个以“gserviceaccount.com”结尾的疯狂字符串),而我的普通帐户无法查看该电子表格。我还需要做什么才能将 Google 用户添加到读/写权限?
from oauth2client.service_account import ServiceAccountCredentials
from googleapiclient import discovery
# ... json_key is the json blob that has the credentials
scope = ['https://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_dict(json_key, scope)
service = discovery.build('sheets', 'v4', credentials=credentials)
spreadsheet = {
"properties": {"title": "my test spreadsheet"}
}
service.spreadsheets().create(body=spreadsheet).execute()
Run Code Online (Sandbox Code Playgroud)
编辑:
我尝试将范围更改为,['https://www.googleapis.com/auth/drive']但下面的答案仍然对我不起作用。当我跑步时
print [xx for xx in dir(service) if not xx.startswith('_')]
Run Code Online (Sandbox Code Playgroud)
我明白了
['new_batch_http_request', u'spreadsheets']
Run Code Online (Sandbox Code Playgroud)
换句话说,这不是我定义的服务permissions()中的方法。service我应该采取什么不同的做法?