在这篇文章中有一个Python示例从csv转换为xls.
但是,我的文件有超过65536行,所以xls不起作用.如果我将文件命名为xlsx,它并没有什么区别.是否有Python包转换为xlsx?
我有一个数据帧df:
var1 var2
"test" "testing"
"esten" "etsen"
"blest" "estten"
Run Code Online (Sandbox Code Playgroud)
现在我要删除df中的所有"t"以获取:
var1 var2
"es" "esing"
"esen" "esen"
"bles" "esen"
Run Code Online (Sandbox Code Playgroud)
我怎么做?
FastAPI 使用 Gunicorn 启动 uvicorn 工作程序,如https://www.uvicorn.org/settings/中所述
但是,gunicorn 不允许使用自定义设置启动 uvicorn,如https://github.com/encode/uvicorn/issues/343中所述
该问题建议覆盖源文件中的 config_kwargs,例如https://github.com/encode/uvicorn/blob/master/uvicorn/workers.py
limit_concurrency我们尝试过,但 uvicorn 不遵守源中多个 uvicorn 文件中的设置:
https://github.com/encode/uvicorn/blob/master/uvicorn/workers.py
# fail
config_kwargs = {
"app": None,
"log_config": None,
"timeout_keep_alive": self.cfg.keepalive,
"timeout_notify": self.timeout,
"callback_notify": self.callback_notify,
"limit_max_requests": self.max_requests, "limit_concurrency": 10000,
"forwarded_allow_ips": self.cfg.forwarded_allow_ips,
}
Run Code Online (Sandbox Code Playgroud)
https://github.com/encode/uvicorn/blob/master/uvicorn/main.py
# fail
kwargs = {
"app": app,
"host": host,
"port": port,
"uds": uds,
"fd": fd,
"loop": loop,
"http": http,
"ws": ws,
"lifespan": lifespan,
"env_file": env_file,
"log_config": LOGGING_CONFIG if log_config is None else log_config,
"log_level": log_level,
"access_log": …Run Code Online (Sandbox Code Playgroud) 我想编写自己的抗干扰工具.我不能/不想使用主机或第三方应用程序.使用IPSEC或Windows防火墙时,它只接受IP地址.有
youtube.[264 TLD]
www.youtube.[264 TLD]
subdomains.youtube.[264 TLD]
显然,没有办法获得youtube子域的完整列表.
有人可以想办法以某种方式获取所有youtube ip地址并在ip级别阻止它们而不是使用暴力子域ping?
我尝试安装所有依赖包,并尝试在另一篇文章中推荐的另一个repo源.
R版本3.2.0 x64
install.packages("fracdiff")
install.packages("Rcpp")
install.packages("RcppArmadillo")
install.packages("colorspace")
install.packages("forecast", dep=T)
install.packages("forecast", repos=c("http://cran.rstudio.com"),dep=T)
library("forecast")
Run Code Online (Sandbox Code Playgroud)
然后我明白了
Loading required package: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
Loading required package: timeDate
Error : .onAttach failed in attachNamespace() for 'forecast', details:
call: fun(libname, pkgname)
error: 4 arguments passed to .Internal(nchar) which requires 3
In addition: Warning message:
package ‘forecast’ was built under R version 3.2.1
Error: package or namespace load failed for ‘forecast’
Run Code Online (Sandbox Code Playgroud)
sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: …Run Code Online (Sandbox Code Playgroud) 有包:RMySQL
如何从R批量上传大量数据到mysql?我有一个大约100万行和80列的csv.
会这样的吗?
dbWriteTable(con, "test2", "~/data/test2.csv") ## table from a file
Run Code Online (Sandbox Code Playgroud)
我担心这会逐行插入......
我必须运行很多随机森林模型,所以我想在我的 8 核服务器上使用 doParallel 来加速这个过程。
然而,某些模型需要比其他模型更长的时间,甚至可能会引发错误。我想并行运行 8 个模型,如果模型抛出错误和/或被跳过,那么工作人员应该继续。每个模型结果都保存在硬盘上,以便我以后可以访问和组合它们。
TryCatch
Run Code Online (Sandbox Code Playgroud)
或者
.errorhandling="remove"
Run Code Online (Sandbox Code Playgroud)
没有解决问题。我得到
Error in unserialize(socklist[[n]]) : error reading from connection
Run Code Online (Sandbox Code Playgroud)
代码示例:我用 %do% 试了一下,模型 2-7 运行成功。然而在 %dopar% 我得到了显示的错误
foreach(model=1:8, .errorhandling="remove") %dopar% {
tryCatch({
outl <- rf_perform(...)
saveRDS(outl,file=getwd() %+% "/temp/result_" %+% model %+% ".rds")
}, error = function(e) {print(e)}, finally = {})
}
Run Code Online (Sandbox Code Playgroud) 我们正在使用fastapi-utils在后台执行计划任务。如果新数据在数据库中可用,我们检查所有 5 秒,如果是,我们处理它(最多需要 5 分钟)
在此期间,协程应处于阻塞状态,以便仅触发一次。
我们注意到我们的数据有时会被处理 3 倍,我们假设调度程序继续运行,即使该函数已被触发。
因此我们试图用IsRunningQuery变量来规避它。
我们尝试了一个带有 while True 循环的解决方案@repeat_every,但不让它在启动时运行一次,但 Azure Webapps 不允许运行它。
@app.on_event("startup")
@repeat_every(wait_first=True,seconds=int(10))
def scheduled_task() -> None:
global IsRunningQuery
global LastCheck
if IsRunningQuery == False:
IsRunningQuery = True
gunicorn_logger.info("status='checkforleads'")
OurProccessingClass.processDataBaseData() # can take up 5 minutes
LastCheck=Utils.datetime()
IsRunningQuery = False
Run Code Online (Sandbox Code Playgroud)
此变体适用于我们的 DEV 环境,但不适用于 Azure
@app.on_event("startup")
async def scheduled_task() -> None:
while True:
gunicorn_logger.info("status='checkforleads'")
OurProccessingClass.processDataBaseData() # can take up 5 minutes
time.sleep(int(os.environ["CRM_SLEEP"]))
Run Code Online (Sandbox Code Playgroud) 我们正在使用https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker FastAPI 并且能够使用 gunicorn 日志文件自定义我们的日志记录。
但是,我们无法更改文档访问日志中定义的 %(message)s 属性的详细信息 - https://docs.gunicorn.org/en/stable/settings.html#accesslog。
我们在下面收到一个错误 postet,密钥未知。之前有人问过类似的问题,并收到了很多赞成票。 gunicorn 日志配置 access_log_format
我们做错了什么?
#start.sh
# Start Gunicorn
exec gunicorn -k uvicorn.workers.UvicornWorker -c "$GUNICORN_CONF" "$APP_MODULE" --log-config "/logging.conf"
Run Code Online (Sandbox Code Playgroud)
[loggers]
keys=root, gunicorn.error, gunicorn.access,uvicorn.error,uvicorn.access
[handlers]
keys=console, error_file, access_file, access_filegunicorn
[formatters]
keys=generic, access, accessgunicorn
[logger_root]
level=INFO
handlers=console
propagate=1
[logger_gunicorn.error]
level=INFO
handlers=error_file
propagate=0
qualname=gunicorn.error
[logger_gunicorn.access]
level=INFO
handlers=access_filegunicorn
propagate=0
qualname=gunicorn.access
[logger_uvicorn.error]
level=INFO
handlers=error_file
propagate=0
qualname=uvicorn.error
[logger_uvicorn.access]
level=INFO
handlers=access_file
propagate=0
qualname=uvicorn.access
[handler_console]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_error_file]
class=StreamHandler
formatter=generic
args=(sys.stdout, )
[handler_access_file]
class=StreamHandler …Run Code Online (Sandbox Code Playgroud) 有人熟悉这个问题吗?https://github.com/Azure/cli中的示例不适用于自托管 github 运行器,看起来是这样az is missing
gitaction.yml
name: auzure-deployment
on:
push:
branches: [ main ]
jobs:
myjob:
runs-on: [self-hosted, linux]
steps:
- uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- uses: azure/CLI@v1
with:
azcliversion: 2.0.72
inlineScript: |
az account list
Run Code Online (Sandbox Code Playgroud)
错误
Runner group name: 'Default'
Machine name: '98de1add3979'
GITHUB_TOKEN Permissions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'azure/login@v1'
Download action repository 'azure/CLI@v1'
0s
Run azure/login@v1
Error: Az CLI Login failed. Please …Run Code Online (Sandbox Code Playgroud)