我的脚本正在做以下事情:
trc文件读取时间序列(UHF 测量)pd.DataFrameDataFrames到一个hdf5文件中这工作正常,但tables模块似乎NaturalNameWarning为每个单个DataFrame.
这是DataFrames保存到的位置hdf5:
num = 0
for idx, row in df_oszi.iloc[peaks].iterrows():
start_peak = idx - 1*1e-3
end_peak = idx + 10*1e-3 #tges=11us
df_pos = df_oszi[start_peak:end_peak]
df_pos.to_hdf('pos.h5', key=str(num))
num += 1
Run Code Online (Sandbox Code Playgroud)
输出:
Warning (from warnings module):
File "C:\Users\Artur\AppData\Local\Programs\Python\Python37\lib\site-packages\tables\path.py", line 157
check_attribute_name(name)
NaturalNameWarning: object name is not a valid Python identifier: '185'; it does not match the pattern ``^[a-zA-Z_][a-zA-Z0-9_]*$``; you will …Run Code Online (Sandbox Code Playgroud) Laravel Vite 文档说要运行:
npx apply laravel:vite --ignore-existing
Run Code Online (Sandbox Code Playgroud)
在您的项目根目录中安装vite在您的laravel project.
当我尝试在新安装的 Laravel 项目中执行此操作时,它会显示以下内容:
zsh:1: command not found: laravel:vite
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
Macos Big Sur与 一起使用PhpStorm。
我在使用 pytesseract 时遇到错误。我是通过 pip install 安装的。
代码:
import pytesseract
from PIL import Image
img = Image.open('frame_0000.png')
x = pytesseract.image_to_string(Image.open('frame_0000.png'))
Run Code Online (Sandbox Code Playgroud)
错误发生在最后一行。(x = ...)
结果:
回溯(最近一次调用):文件“C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\site-packages\pytesseract\pytesseract.py”,第 194 行,在 run_and_get_output run_tesseract(**kwargs ) 文件“C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\site-packages\pytesseract\pytesseract.py”,第 165 行,在 run_tesseract proc = subprocess.Popen(command, **subprocess_args( )) 文件“C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\subprocess.py”,第 707 行,在init restore_signals, start_new_session 中)文件“C:\Users\Artur\AppData\Local\ Programs\Python\Python36\lib\subprocess.py", line 990, in _execute_child startupinfo) FileNotFoundError: [WinError 2] Das System kann die angegebene Datei nicht finden
在处理上述异常的过程中,又发生了一个异常:
回溯(最近一次调用):文件“C:\Users\Artur\Desktop\Pytesseract_test.py”,第 6 行,在 x = pytesseract.image_to_string(Image.open('frame_0000.png')) 文件“C:\ Users\Artur\AppData\Local\Programs\Python\Python36\lib\site-packages\pytesseract\pytesseract.py”,第 286 行,在 image_to_string 中 return run_and_get_output(image, 'txt', lang, config, …
我正在尝试遍历 .png 文件的文件夹并对它们进行 OCR。迭代有效,但是一旦我尝试使用 PIL 打开图像,它就会出错。
import pytesseract
from PIL import Image
import os
for filename in os.listdir('C:/Users/Artur/Desktop/Sequenz_1'):
if filename.endswith('.png'):
print(filename)
Run Code Online (Sandbox Code Playgroud)
这工作得很好。它打印文件夹中的每个 .png 文件名。但是当我尝试 OCR 时:
import pytesseract
from PIL import Image
import os
for filename in os.listdir('C:/Users/Artur/Desktop/Sequenz_1'):
if filename.endswith('.png'):
print(pytesseract.image_to_string(Image.open(filename)))
Run Code Online (Sandbox Code Playgroud)
输出:
Traceback (most recent call last):
File "C:\Users\Artur\Desktop\Pytesseract_test.py", line 8, in <module>
print(pytesseract.image_to_string(Image.open(filename)))
File "C:\Users\Artur\AppData\Local\Programs\Python\Python36\lib\site-packages\PIL\Image.py", line 2580, in open
fp = builtins.open(filename, "rb")
FileNotFoundError: [Errno 2] No such file or directory: 'frame_0000.png'
Run Code Online (Sandbox Code Playgroud)
编辑:
多亏了 Benehiko,它现在工作正常。
代码:
import pytesseract
from …Run Code Online (Sandbox Code Playgroud) 我可以这样分割一个字符串:
string = 'ABC_elTE00001'
string = string.split('_elTE')[1]
print(string)
Run Code Online (Sandbox Code Playgroud)
如何自动执行此操作,因此不必传递'_elTE'给该函数?像这样:
string = 'ABC_elTE00001'
string = string.split('_' + 4 characters)[1]
print(string)
Run Code Online (Sandbox Code Playgroud) 我想显示一些html从数据库中获取的内容quill editor。似乎html很好(在<p>段落中显示)并且绑定到quill editorvia v-model,但它只是不显示:
<template>
<div id="text-editor" class="text-editor">
<quill-editor :modules="modules" :toolbar="toolbar" v-model:content="store.re.body" contentType="html"/>
<p>{{store.re.body}}</p>
</div>
</template>
<script setup>
import BlotFormatter from 'quill-blot-formatter'
import store from "../../../js/store";
store.re.body = ''
const modules = {
module: BlotFormatter,
}
const toolbar = [
[{ 'header': [1, 2, 3, 4, 5, 6, false] }],
[{ 'size': ['small', false, 'large', 'huge'] }],
['bold', 'italic', 'underline', 'strike'],
['blockquote', 'code-block'],
[{ 'align': [] }],
[{ 'list': …Run Code Online (Sandbox Code Playgroud) 我正在尝试绘制大数据(5000 万个值),但我得到了一个MemoryError. 现在我试图从冗余值中清除我的数据集。就我而言,这些都是低于1和高于 的值-1。要记住的一件事是,情节应该看起来与原作一样,但没有噪音。有没有比使用loopsor更好的方法来做到这一点list comprehensions?
原剧情:
编辑:
感谢您的答复。如果我使用建议的方法:
daty = daty[(-1 > daty) | (daty > 1)]
Run Code Online (Sandbox Code Playgroud)
结果如下:
最近我在Ubuntu中编写代码时遇到了一些麻烦,并使其在Windows中运行.
两个平台上的代码:
输出Ubuntu(这就是我想要的):
输出Windows:
正如您所看到的,拆分窗口会添加一个'/'而不是拆分列表'/'.是list.split()不是跨平台?
我发现自己需要借助for循环来遍历列表。我最终要做的是:
L = ['A','B','C','D']
n = 0
for i in L:
print(L[n])
n += 1
Run Code Online (Sandbox Code Playgroud)
我想知道是否有更好的方法来执行此操作,而不必n每次都声明一个额外的变量?
请记住,这只是一个简化的示例。这样的解决方案是不够的(尽管在此示例中,结果是相同的):
L = ['A','B','C','D']
for i in L:
print(i)
Run Code Online (Sandbox Code Playgroud)