{{ transformations:KeepRemoveColumnsAction_Remove.png}}{{ transformations:KeepRemoveColumnsAction.png}} ====== KEEP/REMOVE COLUMNS ====== Category: Transform / Basic\\ \\ =====Description===== This action keeps or removes selected columns. Several columns can be kept or removed within a single action. The action icon will depict whether this action is in "Keep" or "Remove" mode.\\ \\ =====Use cases===== **Keep columns:** Useful for keeping //only// the selected column(s) regardless of other columns being added or deleted upstream. **Delete columns:** Useful for removing columns that are unnecessary for downstream processing. Removing unneeded columns early in the process lowers the computational load on the workflow/system.\\ \\ =====Action settings===== ====Mode options==== ^ Setting ^ Description ^ |Keep selected columns|The chosen columns are kept and all other columns are removed from the dataset.| |Remove selected columns|The chosen columns are removed. You are unable to remove all columns from a dataset.| \\ ====Columns==== A list of columns found in the current dataset is presented to select which columns to keep or remove.\\ \\ =====Examples===== **Example 1 (Remove columns):** Remove the column describing the length of the river in miles. **Source table:** The longest rivers in the world ^River ^Length (km) ^Length (miles) ^Continent ^ | Nile | 6650| 4132|Africa | | Amazon | 6400| 3976|South America | | Yangtze | 6300| 3917|Asia | | Mississippi | 6275| 3902|North America | \\ **Action parameters:** > Columns to remove: Length (miles) \\ **Result table:** ^River ^Length (km) ^Continent ^ | Nile | 6650|Africa | | Amazon | 6400|South America | | Yangtze | 6300|Asia | | Mississippi | 6275|North America | \\ \\ **Example 2 (Keep columns):** Keep only the River and Continent columns - remove all others. **Source table:** The longest rivers in the world ^River ^Length (km) ^Length (miles) ^Continent ^ | Nile | 6650| 4132|Africa | | Amazon | 6400| 3976|South America | | Yangtze | 6300| 3917|Asia | | Mississippi | 6275| 3902|North America | \\ **Action parameters:** > Columns to keep: River, Continent\\ \\ **Result table:** ^River ^Continent ^ | Nile |Africa | | Amazon |South America | | Yangtze |Asia | | Mississippi |North America | \\ ====Community examples==== * [[https://community.easymorph.com/t//1273/6|Split Excel spreadsheets into multiple spreadsheets]] ([[https://community.easymorph.com/uploads/short-url/6iWYdZJc4yAvqYMbTGZWXtVFmvL.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//; Action position: //2//) * [[https://community.easymorph.com/t//1360/2|Rounding time to the nearest minute]] ([[https://community.easymorph.com/uploads/short-url/qiQbLyXpYydJclxrArqkQzCVgr9.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1//; Action position: //3//) * [[https://community.easymorph.com/t//1499/2|Data cleaning for data spread over multiple rows and columns]] ([[https://community.easymorph.com/uploads/short-url/kgmVTEHcl0CE7Yep5uzuGW1HLKc.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Table 1(3)//;\\ Action position: //2//) * [[https://community.easymorph.com/t//1649/14|Update existing data in a database table]] ([[https://community.easymorph.com/uploads/short-url/hauw3ZALjf9UqXAOP8prtLUNbxH.morph|Project]]; Module: //Main//; Group: //Tab 1//; Table: //Where clause//; Action position: //4//) * [[https://community.easymorph.com/t//2628/3|Matrix multiplication]] ([[https://community.easymorph.com/uploads/short-url/3fLTtB9Jd0bioRfyASiJo9m6Cqv.morph|Project]]; Module: //Main//; Group: //Group 1//; Table: //Matrix multiplication//; Action position: //7//) * [[https://community.easymorph.com/t//2158/5|API pagination how I create loop]] ([[https://community.easymorph.com/uploads/short-url/rQmjCeA2LXPlqzxhL5N9IoCE5CR.morph|Project]]; Module: //baseProcess//; Group: //Pull data from API//; Table: //iterationCalculation//;\\ Action position: //6//) \\ =====Shortcuts===== Fast ways to create the action:\\ **Remove columns:** *Right-click on the column heading and select //Remove column// from the context menu. *Click the drop-down arrow in the column heading and select //Remove column// from the context menu. *You can remove //multiple// columns by first selecting the columns to remove, then choosing //Remove (#) columns//from the context menu. **Keep columns:** *Right-click on the column heading and select //Select column// from the context menu. *Click the drop-down arrow in the column heading and select //Select column// from the context menu. *You can keep //multiple// columns by first selecting the columns to keep, then choosing //Select (#) columns// from the context menu. \\ =====See also===== * [[transformations:replacecolumn|Modify column(s)]] * [[transformations:rename|Rename columns]] * [[transformations:reorder|Reorder columns]]