小编fel*_*xmc的帖子

绘制数字向量,名称为x刻度

我有一个数字向量,并希望在y轴上按x轴上的名称绘制每个值.

例:

quantity <- c(3,5,2)
names(quantity) <- c("apples","bananas", "pears")
plot(quantity)
Run Code Online (Sandbox Code Playgroud)

每个值都沿着x轴绘制,其中包含索引号.1,2,3.我怎样才能展示它("苹果","香蕉","梨")?

plot r

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

Powershell脚本的速度.寻求优化

我有一个工作脚本,其目的是在导入Oracle之前解析格式错误的行的数据文件.要处理450MB csv文件,其中包含大于1百万行的8列,需要2.5小时,最多只需一个CPU内核.小文件快速完成(以秒为单位).

奇怪的是,具有相似行数和40列的350MB文件只需要30分钟.

我的问题是文件会随着时间的推移而增长,并且2.5小时占用CPU并不好.谁能推荐代码优化?一个类似的标题帖推荐了本地路径 - 我已经在做了.

$file = "\Your.csv"

$path = "C:\Folder"

$csv  = Get-Content "$path$file"

# Count number of file headers
$count = ($csv[0] -split ',').count

# https://blogs.technet.microsoft.com/gbordier/2009/05/05/powershell-and-writing-files-how-fast-can-you-write-to-a-file/
$stream1 = [System.IO.StreamWriter] "$path\Passed$file-Pass.txt"
$stream2 = [System.IO.StreamWriter] "$path\Failed$file-Fail.txt"

# 2 validation steps: (1) count number of headers is ge (2) Row split after first col.  Those right hand side cols must total at least 40 characters.
$csv | Select -Skip 1 | % {
  if( ($_ -split ',').count -ge $count -And …
Run Code Online (Sandbox Code Playgroud)

csv powershell performance if-statement

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

标签 统计

csv ×1

if-statement ×1

performance ×1

plot ×1

powershell ×1

r ×1