你好,
我的原始 csv 文件格式很奇怪,导致我需要将第一个数据点作为标题导入,这不是我想要的。 所以我在顶部创建了一个新的空白行,并试图弄清楚如何在重命名标题之前将列名拉入空白行? 任何帮助表示赞赏!
names default to here(1);
dt=current data table();
For (i=1, i<=2, i++,
Row(1)[i] = Char(Column Name(i));
);
您应该能够修改设置以补偿 csv 文件中的奇怪格式。下面是一个打开 csv 文件的简单脚本,您可以更改列名 Start() 和 Data Starts() 参数,以免以错误的标题或数据结束。
Open(
"Path to your csv file",
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Comma, CSV( 1 ) ),
Strip Quotes( 0 ),
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( 1 ),
Data Starts( 2 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
只需打开一个 csv 文件,然后通过右键单击打开的数据表左侧的表面板中源条目前面的绿色三角形,即可检索这些 JSL 语句。