如何填充錯誤格式的列我有一個1.6M行的數據表。 該數據表是通過連接許多較小的數據表而形成的。 不幸的是,這些較小的數據表在許多列中都存在差距。例如,將有數千行全部寫在同一日期,但日期和時間戳僅填充在較小數據表的頂行。這意味著我有一個數據表,其中每天只有9,000-12,000行填充日期字段,其間的所有內容都是空白的。
是否可以進行某種智能填充,其中填充帶有值的空行,直到它到達非空行,然後用這個新值開始填充後續行?對於我的1.6M行長數據表中的每批10K行,使用蹩腳的fill-to-row命令手動執行此操作將需要一個永恆的時間。
現在看起來如何:
| 行# | 日期 | 事ID | 數據1 | 數據2 |
| 1 | 2013年3月8日 | X001 | Attr.1 | Color.3 |
| 2 | | | Attr.2 | Color.2 |
| ... | | | ... | ... |
9653 | | | Attr.9653 | Color.9653 |
9654 | 2013年3月21日 | X002 | ATTR1 | Color.1 |
| 9655 | | | Attr.2 | Color.2 |
| ... | | | ... | ... |
| 19,630 | | | Attr.9975 | Color.9975 |
| 19631 | 2013年3月30日 | X003 | Attr.1 | Color.1 |
| 19632 | | | Attr.2 | Color.2 |
| .. | | | ... | ... |
我希望如何看待:
| 行# | 日期 | 事ID | 數據1 | 數據2 |
| 1 | 2013年3月8日 | X001 | Attr.1 | Color.3 |
| 2 | 2013年3月8日 | X001 | Attr.2 | Color.2 |
| ... | 2013年3月8日 | X001 | ... | ... |
9653 | 2013年3月8日 | X001 | Attr.9653 | Color.9653 |
9654 | 2013年3月21日 | X002 | ATTR1 | Color.1 |
| 9655 | 2013年3月21日 | X002 | Attr.2 | Color.2 |
| ... | 2013年3月21日 | X002 | ... | ... |
| 19,630 | 2013年3月21日 | X002 | Attr.9975 | Color.9975 |
| 19631 | 2013年3月30日 | X003 | Attr.1 | Color.1 |
| 19632 | 2013年3月30日 | X003 | Attr.2 | Color.2 |
| .. | 2013年3月30日 | X003 | ... | ... |
回复:如何填充錯誤格式的列這是一個簡單的腳本,可以解決這個問題
Names Default To Here( 1 );
dt = Current Data Table();
// for example I will call the column in question, "date"
For Each Row(
If( Is Missing( :date ) == 1,
:date = Lag( :date )
)
);