csv ファイルをテーブルにインポートしていますが、一部の列の名前にスペースが含まれています。とにかくこれについてはありますか、それともインポートする前に列の名前を変更する必要がありますか?
3663 次
4 に答える
1
テーブル t の列名からスペースを削除するには:
t:xcol[`$ssr[;" ";""]each string cols t;t]
于 2014-02-21T16:09:45.080 に答える
0
列名を一般的にクリーンアップしたい場合は、以下のcleancols
関数が役立ちます
rmbad:{`$string[x] inter\: .Q.an} //remove bad characters
//make sure first elem is a char
inichar:{`$@[s; where in[ ;.Q.n] first each s:string x;"c",]}
//rename duplicates
dupes:{@[x;g n;:;`$string[n],/:'string til each gc n:where 1<gc:count each g:group x]}
cleancols:dupes inichar rmbad cols@ //clean column names
cleancols[x] xcol x:flip (`$("bad*";"ba;d*"))!5 cut til 10
cleancols[x] xcol x:flip (`$("ok1";"1&* (ba;d*"))!5 cut til 10
于 2014-04-25T20:57:21.637 に答える
0
CSV データをテーブルに読み取ったら、xcolを使用して列の名前を変更できます。
于 2014-02-20T06:30:28.023 に答える