在xlswriter中,一旦定义了格式,如何将它应用于范围而不是整列或整行?
例如:
perc_fmt = workbook.add_format({'num_format': '0.00%','align': 'center'})
worksheet.set_column('B:B', 10.00, perc_fmt)
Run Code Online (Sandbox Code Playgroud)
这会将它应用到整个"B"列,但是如何将"perc_fmt"应用于范围,例如,如果我这样做:
range2 = "B2:C15"
worksheet2.write(range2, perc_fmt)
Run Code Online (Sandbox Code Playgroud)
它说:
TypeError: Unsupported type <class 'xlsxwriter.format.Format'> in write()
Run Code Online (Sandbox Code Playgroud) 我通过pip在CentOS 7上设置pyparser时看到以下错误
/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-PMzCYU/pycparser/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-0bpBrX-record/install-record.txt --single-version-externally-managed --compile
Traceback (most recent call last):
File "", line 1, in init.py", line 12, in
import setuptools.version
File "/usr/lib/python2.7/site-packages/setuptools/version.py", line 1, in
import pkg_resources
File "/usr/lib/python2.7/site-packages/pkg_resources/init.py", line 72, in
import packaging.requirements
File "/usr/lib/python2.7/site-packages/packaging/requirements.py", line 59, in
MARKER_EXPR = originalTextFor(MARKER_EXPR())("marker")
TypeError: call() takes exactly 2 arguments (1 given)
我正在尝试使用simple_salesforce来使用Python查询salesforce数据.我正在使用我的用户名和密码,我100%肯定是正确的.我从登录Salesforce并查看我的公司资料中获得了组织ID.这只是一个15位数的ID.我特意使用orgID来避免使用安全令牌,因为我不知道它是什么.我究竟做错了什么?
码:
from simple_salesforce import Salesforce
sf = Salesforce(instance_url='https://na1.salesforce.com', session_id='')
sf = Salesforce(password='password', username='email', organizationId='15 digit org id')
Run Code Online (Sandbox Code Playgroud)
输出:
File "C:\Python27\lib\site-packages\simple_salesforce\api.py", line 100, in __init__
proxies=self.proxies)
File "C:\Python27\lib\site-packages\simple_salesforce\login.py", line 124, in SalesforceLogin
code=except_code, message=except_msg))
simple_salesforce.login.SalesforceAuthenticationFailed: INVALID_LOGIN: Invalid username, password, security token; or user locked out.
Run Code Online (Sandbox Code Playgroud) 当我使用GMail API发送电子邮件时,我获得了要向其发送消息的用户的访问令牌,然后在发送消息时,我在From字段中添加了一些值.
但是无论我放在from字段中,电子邮件中的消息都显示为From"Me",并且位于Sent邮件和收件箱中.
有没有办法,我可以使用服务帐户发送电子邮件,这样它就不会显示为From"Me",也不会出现在Sent Mails中.
我开始学习 SalesForce 并使用 django 开发应用程序。
我需要将文件上传到 salesforce 方面的帮助,为此我阅读了simple-salesforce,这有助于使用 Rest 和 SOAP api 上传文件。
我的问题是如何使用 simple-salesforce 上传一个或多个文件?
对于python数据框,info()函数提供内存使用情况。pyspark有任何等效功能吗?谢谢
这个想法是使用指向节点的变量而不是硬编码的路径,我的解决方案是 ExecStart="$(which node)" /home/jonma/Development/chewy
但是,当我运行该服务时,出现以下错误:
feb 08 11:12:51 jonma-VirtualBox systemd[1]: [/lib/systemd/system/chewy.service:2] Executable path is not absolute, ignoring: $(which node) /home/jon
feb 08 11:12:51 jonma-VirtualBox systemd[1]: chewy.service: Service lacks both ExecStart= and ExecStop= setting. Refusing.
Run Code Online (Sandbox Code Playgroud)
如何在不对路径进行硬编码的情况下实现这一目标?
我正在尝试将 Salesforce 数据加载到 Python 数据框中,以便我们可以在那里进行所有操作。simple_salesforce 处理了我们达到 2,000 人限制的警告:
from simple_salesforce import Salesforce as s
eatpies = sf.query('Select Id from Case')
attrs = ['Id']
records = eatpies['records']
data = {}
for rec in records:
for k in attrs:
data.setdefault(k, []).append(rec[k])
dframe = pd.DataFrame(data)
print(dframe)
Run Code Online (Sandbox Code Playgroud)
据说, salesforce-bulk (https://pypi.python.org/pypi/salesforce-bulk/1.0.7)能够绕过这个限制,但我不能比这更进一步:
job = bulk.create_query_job("Case", contentType='CSV')
batch = bulk.query('select Id, type from Case')
TypeError Traceback (most recent call last)
<ipython-input-13-076e14bf245d> in <module>()
----> 1 batch = bulk.query('select Id, type from Case')
TypeError: query() missing …Run Code Online (Sandbox Code Playgroud) 我正在使用Python Simple-Salesforce通过SOQL查询数据.我知道SOQL语法中不支持"SELECT*",所以我想创建一个Python脚本来收集要插入SELECT语句的所有字段的字符串列表.以下是我描述帐户对象的方式:
from simple_salesforce import Salesforce
from simple_salesforce import SFType
#(credentials hidden)
sf = Salesforce(username=username, password=password,
security_token=security_token, sandbox=True,
client_id='mwheeler App')
desc = sf.Account.describe()
print(desc)
Run Code Online (Sandbox Code Playgroud)
如何从下面显示的有序词典中将字段名称提取到字符串列表中?
desc:
OrderedDict([('actionOverrides',[]),('activateable',False),('childRelationships',[OrderedDict([('cascadeDelete',False),('childSObject','Account'),('deprecatedAndHidden ',False),('field','ParentId'),('junctionIdListNames',[]),('junctionReferenceTo',[]),('relationshipName','ChildAccounts'),('restrictedDelete',False) ]),OrderedDict([('cascadeDelete',True),('childSObject','AccountCleanInfo'),('deprecatedAndHidden',False),('field','AccountId'),......
我将使用字符串列表来选择所有字段:
query = sf.query_all("SELECT string_list FROM Account")
Run Code Online (Sandbox Code Playgroud) 获取忽略ensurepip失败PIP需要SSL / TLS尝试安装Python和PIP在当错误的Ubuntu 18.04
尝试运行sudo make install会出现上述错误。
# Download Python
curl -O https://www.python.org/ftp/python/3.4.2/Python-3.4.2.tgz
tar -xzvvf Python-3.4.2.tgz
cd Python-3.4.2
export CFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib -I/usr/local/opt/zlib/include -L/usr/local/opt/zlib/lib"
# Required Dependencies
sudo apt-get install libssl-dev openssl
sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libpq-dev zlib1g-dev
# Prepare to install Python
./configure
make -j4
sudo make install
Run Code Online (Sandbox Code Playgroud) python ×8
salesforce ×4
pip ×2
apache-spark ×1
centos7 ×1
dataframe ×1
debian ×1
django ×1
gmail-api ×1
linux ×1
pandas ×1
pycparser ×1
pyspark ×1
python-2.7 ×1
soap ×1
soql ×1
systemd ×1
ubuntu ×1
xlsxwriter ×1