你好,
我的原始 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 語句。