小编Gui*_*not的帖子

Python平滑数据

我有一个我想要平滑的数据集.我有两个不均匀间隔的变量y和x.y是因变量.但是,我不知道x与y有什么关系.

我读了所有关于插值的内容,但插值要求我知道将x与y相关的公式.我还查看了其他平滑函数,但这些函数会导致起点和终点出现问题.

有谁知道如何: - 获得一个将x与y相关联的公式 - 平滑数据点而不会弄乱端点

我的数据如下:

import matplotlib.pyplot as plt

x = [0.0, 2.4343476531707129, 3.606959459205791, 3.9619355597454664, 4.3503348239356558, 4.6651002761894667, 4.9360228447915109, 5.1839565805565826, 5.5418099660513596, 5.7321342976055165,5.9841050994671106, 6.0478709402949216, 6.3525180590674513, 6.5181245134579893, 6.6627517592933767, 6.9217136972938444,7.103121623408132, 7.2477706136047413, 7.4502723880766748, 7.6174503055171137, 7.7451599936721376, 7.9813193157205191, 8.115292520850506,8.3312689109403202, 8.5648187916197998, 8.6728478860287623, 8.9629327234023926, 8.9974662723308612, 9.1532523634107257, 9.369326186780814, 9.5143785756455479, 9.5732694726297893, 9.8274813411538613, 10.088572892445802, 10.097305715988142, 10.229215999264703, 10.408589988296546, 10.525354763219688, 10.574678982757082, 10.885039893236041, 11.076574204171795, 11.091570626351352, 11.223859812944436, 11.391634940142225, 11.747328449715521, 11.799186895037078, 11.947711314893802, 12.240901223703657, 12.50151825769724, 12.811712563174883, 13.153496854155087, 13.978408296586579, 17.0, 25.0]
y = [0.0, 4.0, 6.0, 18.0, 30.0, 42.0, 54.0, 66.0, 78.0, 90.0, 102.0, 114.0, 126.0, …
Run Code Online (Sandbox Code Playgroud)

python smoothing

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

ZMQ:多个请求/回复对

ZeroMQs Pub/Sub模式使服务器可以轻松回复正确的客户端.然而,如何处理无法在两个步骤中解决的通信,即不需要多个请求/回复对的协议,则不太明显.

例如,考虑一种情况,客户端是一个工作人员,要求服务器提供特定类型的新工作,服务器回复工作的参数,然后客户端发送结果,服务器检查这些并回复它们是否是正确.

显然,我不能只使用recv,send,recv,顺序发送并假设第一个和第二个recv来自同一个客户端.使用多个recv,发送对而不必处理来自其他客户端的消息的惯用方法是什么?

zeromq

5
推荐指数
1
解决办法
6296
查看次数

AttributeError: '_io.BufferedReader' 对象没有属性 'strip'

我有这个错误。为什么?

File "/k.py", line 257, in deskJ
    eremuak = aFileLine.strip().split('\t')
AttributeError: '_io.BufferedReader' object has no attribute 'strip'
Run Code Online (Sandbox Code Playgroud)

代码

def deskribapenaJaso(self, aFileLine):
    eremuak = aFileLine.strip().split('\t')
    print(eremuak) #printNothing
Run Code Online (Sandbox Code Playgroud)

aFileLine = 它是文件的 X 行

python attributeerror

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

使用FFMPEG压缩图像

如果有任何方法使用FFMPEG压缩图像,请告诉我

ffmpeg -i img.png imgOut.png
Run Code Online (Sandbox Code Playgroud)

如何压缩输出图像或改变质量

ffmpeg

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

将超链接添加到由pandas dataframe to_excel方法创建的Excel工作表

我已经使用将pandas DataFrame 转换为Excel工作表df.to_excel.

现在,我想在一列中添加超值的超链接.换句话说,当客户看到我的Excel工作表时,他就可以点击一个单元格并显示一个网页(取决于此单元格中的值).

python excel hyperlink pandas

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

Caffe 到 Tensorflow(Ethereon 的 Kaffe):类型错误:不应直接创建描述符,而只能从其父项中检索

我想使用 ethereon 的精彩包 caffe-tensorflow,但遇到了这个已关闭问题中描述的相同问题 :

当我运行示例或尝试时,import caffepb我收到错误消息:

>>> import caffepb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "caffepb.py", line 28, in <module>
        type=None),
  File "/home/me/anaconda/python2.7/site-packages/google/protobuf/descriptor.py", line 652, in __new__
    _message.Message._CheckCalledFromGeneratedFile()
TypeError: Descriptors should not be created directly, but only retrieved from their parent.
Run Code Online (Sandbox Code Playgroud)

我在带有 protobuf 3.0.0b2.post(但它也发生在 3.0.0a4 和 3.0.0b2 上)的 Linux 64 位 UBUNTU 14.04 机器上使用 Tensorflow 0.7.0 和 Python 2.7 和 anaconda。

我多次尝试重新安装 protobuf 和 tensorflow,因为我认为这很可能是不同 protobuf 安装之间的冲突(或者至少这是 github 问题的结论),但即使在组合 …

protocol-buffers python-2.7 caffe tensorflow

4
推荐指数
1
解决办法
3712
查看次数

为Python 3安装pip

当我输入python3 --version终端时,它显示了Python 3.6.0.

当我输入pip --version它显示

pip 9.0.1 from /Library/Python/2.7/site-packages/pip-9.0.1-py2.7.egg (python 2.7)
Run Code Online (Sandbox Code Playgroud)

我如何得到它Python/2.7Python/3.6

python pip python-2.7 python-3.x macos-sierra

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

如何在 Selenium python firefox 中启用 flash

当我打开 firefox 时,它安装了 Flash,但是当我通过 selenium 打开它时,firefox 的版本中没有 Flash。如何在 selenium 中启用 flash。这是我正在使用的测试代码:

firefoxProfile = FirefoxProfile()
firefoxProfile.set_preference('dom.ipc.plugins.enabled.libflashplayer.so','true')
b = webdriver.Firefox(firefoxProfile, executable_path=r"C:\\Program Files\geckodriver-v0.16.1-win64\geckodriver.exe")
b.get("http://www.python.org")
Run Code Online (Sandbox Code Playgroud)

python flash firefox selenium

4
推荐指数
1
解决办法
1649
查看次数

Python PPTX读取幻灯片编号(页码)

我正在为由 Python-PPTX 生成的幻灯片制作自定义目录。对于已经设置好的幻灯片、页脚和幻灯片编号,我已经可以在生成的 PPTX 中查看它。我相信幻灯片编号已经存在,只需要阅读即可。

我的问题是,是否可以从幻灯片对象或其他地方访问幻灯片编号信息?整体脚本如下所示:

from pptx import Presentation
prs = Presentation()
for x in 'abc':
    s = prs.slides.add_slide(prs.slide_layouts[6])

    if x=='b':
        s.placeholders[0].text = <str: page number of current slide 's'>
Run Code Online (Sandbox Code Playgroud)

python python-pptx

4
推荐指数
1
解决办法
5701
查看次数

python re用于验证字符串

以下是代码:

import re
string = "02:222222"
if re.match(r'[a-fA-F0-9]+[a-fA-F0-9]+:+[a-fA-F0-9]+[a-fA-F0-9]+$',string):
    print "pass"
else:
    print "fail"
Run Code Online (Sandbox Code Playgroud)

上面的代码是打印"通过"

我的预期输出应该是"失败"

以下是几个例子:

string = 00:20
expected output: pass
string = 00:202
expected ouput: fail
string = 00:2z
expected output: fail
string = 000:2
expected ouput: fail
Run Code Online (Sandbox Code Playgroud)

python regex

4
推荐指数
1
解决办法
55
查看次数