自动导入文件我使用工作流导入了一个 excel 文件,正在编辑脚本以使其更加通用。在导入设置中,列名开始下有一个特定数字,但我希望它是在满足特定条件时(例如,当第 5 行第 2 列显示 START 时,start 是列名)。
任何正确的帮助都将不胜感激。
代码片段如下,其中重要函数以粗体显示:
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 1 ),
Column Names Start( 263 ),
First Named Column( 1 ),
Data Starts( 264 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
自动化和脚本内容组织数据混合和清理数据探索与可视化回复:自动导入文件下面是一些伪代码,可能会帮助您了解可能使用的方法
dt = Open(<EXCEL file="">);
// Get the first row where the second column has the word START
headerRow = dt << get rows where( contains( as column(2), "START" )[1];
dataRow = headerRow + 1;
// Close the data table
close(dt, nosave);
// Substitute into the full Excel Import Settings the the header row number and
// the data row number and run the code
Eval(
Substitute(
Expr(
dt = Open(.........
Column Names Start( _H_ ),
First Named Column( 1 ),
Data Starts( _S_ ),
......................);
),
expr( _H_ ), headerRow,
expr( _S_ ), dataRow
)
);</EXCEL>
回复:自动导入文件导入整个文件并在导入后在 JMP 中执行数据清理可能会更容易(当然取决于您的数据)。