transformations:keeptop
This is an old revision of the document!
Keep Top Rows
This transformation keeps only first N rows and removes all other rows.
If you need to remove bottom rows – add line numbers using Enumerate Rows, sort backwards by row numbers using Sort and then apply Keep Top Rows.
EXAMPLE
Source table: The longest rivers in the world in descending order (by length)
River | Length (km) | Continent |
---|---|---|
Nile | 6650 | Africa |
Amazon | 6400 | South America |
Yangtze | 6300 | Asia |
Mississippi | 6275 | North America |
Yenisei | 5539 | Asia |
Yellow River | 5464 | Asia |
Ob | 5410 | Asia |
Paraná | 4880 | South America |
Objective: Keep the top three longest rivers
Transformation parameters:
- Number of rows: 3
Output table:
River | Length (km) | Continent |
---|---|---|
Nile | 6650 | Africa |
Amazon | 6400 | South America |
Yangtze | 6300 | Asia |
transformations/keeptop.1430484948.txt.gz · Last modified: 2015/05/01 08:55 by dmitry