Add Column
The Add Column function allows you to create new columns for existing datasets.
When adding a new column, you must create a mathematical expression. This expression evaluates each row in the dataset to generate the new column.
In Studio, expressions are created using a combination of:
- Column names, referencing the values of other columns in the table.
- Constant values, such as numbers or strings.
- Mathematical operators , such as plus, minus, or parenthesis. See the expression syntax reference.
- Function calls to Studio's built-in library of mathematical and geospatial functions.
Add a New Column to Studio
Follow the steps below to add a new column in Studio:
1. Navigate to the Columns tab, select a dataset, then click Add Column.
2. Write an expression in the field provided.
After creating a new column the expression editor appears. Expressions can be simple, employing simple math operators and column names. To find more advanced functions, check out our library of built-in functions in the left sidebar.
Type or drag and drop the function into the editor. When you start typing a function, all matching functions, and their descriptions along with expected parameters will appear in the editor.
Be sure to preview the results of your column in the preview of your dataset below the editor.
3. Click Confirm to create your new column.
The new column will appear on the top of the dataset's attribute columns.
Columns created in Studio have a badge, which you can click to open the Edit Column panel.
Examples
The following are examples of simple expressions. For additional guidance,visit the Expressions documentation.
Compute the ratio of two attributes:
attribute_column_one / attribute_column_total;
Calculate the absolute value of a column with 20 subtracted:
abs(column_example - 20);
Index data to H3 at resolution 9:
geoToH3(lat, lng, 9);
Truncate a Placekey to just the Where Part:
substring(placekey, indexOf(placekey, "@"));
Pad a string with zeroes:
padStart(zip, 5, "0");
Find the centroid of a polygon:
centroid(_geojson);
Parse a string
into a timestamp
:
parseTime(time);
Updated 10 months ago