User Tools

Site Tools


transformations:keeptop

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
transformations:keeptop [2015/04/10 12:45] elenaptransformations:keeptop [2021/05/04 17:46] craigt
Line 1: Line 1:
-===== Keep Top Rows =====+{{ transformations:TrimTableAction.png}} 
 +====== TRIM TABLE ====== 
 +Category: Transform / Filters\\
  
-This transformation keeps only first N rows and removes all other rows.+\\  
 +=====Description===== 
 +This action keeps or removes the first or last N rows.\\
  
-If you need to remove bottom rows -- add line numbers using [[transformations:enumerate|Enumerate Rows]]sort backwards by row numbers using [[transformations:sort|Sort]] and then apply Keep Top Rows.+\\ 
 +=====Use cases===== 
 +Reduce the size of a larger dataset to a specific number of rows during the initial build of a workflow.  Remove the //Trim table// action when the workflow is completeto process the entire dataset.
  
-EXAMPLE+Remove extraneous metadata from the top or bottom of a dataset.\\
  
-**Source table:** The longest rivers in the world 
  
- River   Length (km)  ^  Continent  +\\  
-Nile   6650  |  Africa  +=====Action settings===== 
-Amazon   6400  |  South America  +^Setting ^Description 
-Yangtze   6300  |  Asia  +|Keep only/Remove|Select whether N number of rows will be kept or removed.
-Mississippi  |  6275  |  North America +|Top/Bottom|Select whether the rows at the top or bottom of the table will be kept/removed.
-| Yenisei  |  5539  |  Asia  | +|N rows<sup>*</sup>|Enter/Select the number of rows to keep/remove.
-| Yellow River  |  5464  |  Asia  | +<sup>*</sup> Setting can be specified using a [[:parameters|parameter]].
-| Ob  |  5410  |  Asia  | +
-| Paraná  |  4880  |  South America  |+
  
 +\\ 
 +=====Examples=====
 +**Objective:** Keep the top three longest rivers.\\
 +\\ 
 +**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  |
 +\\ 
 +**Action parameters:**
 +> Keep or Remove is "Keep"
 +> Top or Bottom is "Top"
 +> Number of rows is "3"
 +\\ 
 +**Result:**
 +^River  ^Length (km)  ^Continent  ^
 +| Nile  |  6650|Africa  |
 +| Amazon  |  6400|South America  |
 +| Yangtze  |  6300|Asia  |
  
-**Objective:** Keep the three top rows in the table+\\  
 +=====See also===== 
 +  [[transformations:keepremovematching|Keep/remove matching]]
  
-**Transformation parameters:** 
-  * Number of rows: 3 
- 
-**Output table:** 
- 
-^  River  ^  Length (km)  ^  Continent  ^ 
-| Nile  |  6650  |  Africa  | 
-| Amazon  |  6400  |  South America  | 
-| Yangtze  |  6300  |  Asia  | 

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki