Column
A named, one-dimensional collection of homogeneous values.
Parameters:
| Name |
Type |
Description |
Default |
name |
String |
The name of the column. |
- |
data |
List<T> |
The data of the column. |
- |
type |
ColumnType? |
The type of the column. If null (default), the type is inferred from the data. |
null |
Type parameters:
| Name |
Upper Bound |
Description |
Default |
T |
Any? |
- |
Any? |
Examples:
pipeline example {
out Column("a", [1, 2, 3]);
out Column("a", [1, 2, 3], type = ColumnType.string());
}
Stub code in Column.sdsstub
| @Category(DataScienceCategory.BasicElement)
class Column<out T = Any?>(
name: String,
data: List<T>,
type: ColumnType? = null
) {
/**
* The name of the column.
*/
attr name: String
/**
* The number of rows.
*
* **Note:** This operation must fully load the data into memory, which can be expensive.
*/
@PythonName("row_count") attr rowCount: Int
/**
* The plotter for the column.
*
* Call methods of the plotter to create various plots for the column.
*/
attr plot: ColumnPlotter
/**
* The type of the column.
*/
attr type: ColumnType
/**
* Return the distinct values in the column.
*
* @param ignoreMissingValues Whether to ignore missing values.
*
* @result distinctValues The distinct values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, 2]);
* out column.getDistinctValues();
* }
*/
@Pure
@PythonName("get_distinct_values")
fun getDistinctValues(
@PythonName("ignore_missing_values") ignoreMissingValues: Boolean = true
) -> distinctValues: List<T?>
/**
* Return the column value at specified index. This is equivalent to the `[]` operator (indexed access).
*
* Nonnegative indices are counted from the beginning (starting at 0), negative indices from the end (starting at
* -1).
*
* @param index Index of requested value.
*
* @result value Value at index.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.getValue(0);
* out column[0];
* out column.getValue(-1);
* out column[-1];
* }
*/
@Pure
@PythonName("get_value")
fun getValue(
index: Int
) -> value: T
/**
* Check whether all values in the column satisfy the predicate.
*
* The predicate can return one of three values:
*
* * true, if the value satisfies the predicate.
* * false, if the value does not satisfy the predicate.
* * null, if the truthiness of the predicate is unknown, e.g. due to missing values.
*
* By default, cases where the truthiness of the predicate is unknown are ignored and this method returns
*
* * true, if the predicate always returns true or null.
* * false, if the predicate returns false at least once.
*
* You can instead enable Kleene logic by setting `ignoreUnknown = false`. In this case, this method returns
*
* * true, if the predicate always returns true.
* * false, if the predicate returns false at least once.
* * null, if the predicate never returns false, but at least once null.
*
* @param predicate The predicate to apply to each value.
* @param ignoreUnknown Whether to ignore cases where the truthiness of the predicate is unknown.
*
* @result allSatisfyPredicate Whether all values in the column satisfy the predicate.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, null]);
* out column.all((cell) -> cell > 0);
* out column.all((cell) -> cell < 3);
* out column.all((cell) -> cell > 0, ignoreUnknown = false);
* out column.all((cell) -> cell < 3, ignoreUnknown = false);
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQGeneral)
fun all(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> allSatisfyPredicate: Boolean?
/**
* Check whether any value in the column satisfies the predicate.
*
* The predicate can return one of three values:
*
* * true, if the value satisfies the predicate.
* * false, if the value does not satisfy the predicate.
* * null, if the truthiness of the predicate is unknown, e.g. due to missing values.
*
* By default, cases where the truthiness of the predicate is unknown are ignored and this method returns
*
* * true, if the predicate returns true at least once.
* * false, if the predicate always returns false or null.
*
* You can instead enable Kleene logic by setting `ignoreUnknown = false`. In this case, this method returns
*
* * true, if the predicate returns true at least once.
* * false, if the predicate always returns false.
* * null, if the predicate never returns true, but at least once null.
*
* @param predicate The predicate to apply to each value.
* @param ignoreUnknown Whether to ignore cases where the truthiness of the predicate is unknown.
*
* @result anySatisfyPredicate Whether any value in the column satisfies the predicate.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, null]);
* out column.any((cell) -> cell > 2);
* out column.any((cell) -> cell < 0);
* out column.any((cell) -> cell > 2, ignoreUnknown = false);
* out column.any((cell) -> cell < 0, ignoreUnknown = false);
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQGeneral)
fun any(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> anySatisfyPredicate: Boolean?
/**
* Count how many values in the column satisfy the predicate.
*
* The predicate can return one of three results:
*
* * true, if the value satisfies the predicate.
* * false, if the value does not satisfy the predicate.
* * null, if the truthiness of the predicate is unknown, e.g. due to missing values.
*
* By default, cases where the truthiness of the predicate is unknown are ignored and this method returns how
* often the predicate returns true.
*
* You can instead enable Kleene logic by setting `ignoreUnknown = false`. In this case, this method returns null if
* the predicate returns null at least once. Otherwise, it still returns how often the predicate returns true.
*
* @param predicate The predicate to apply to each value.
* @param ignoreUnknown Whether to ignore cases where the truthiness of the predicate is unknown.
*
* @result count The number of values in the column that satisfy the predicate.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, null]);
* out column.countIf((cell) -> cell > 1);
* out column.countIf((cell) -> cell < 0, ignoreUnknown = false);
* }
*/
@Pure
@PythonName("count_if")
fun countIf(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> count: Int?
/**
* Check whether no value in the column satisfies the predicate.
*
* The predicate can return one of three values:
*
* * true, if the value satisfies the predicate.
* * false, if the value does not satisfy the predicate.
* * null, if the truthiness of the predicate is unknown, e.g. due to missing values.
*
* By default, cases where the truthiness of the predicate is unknown are ignored and this method returns
*
* * true, if the predicate always returns false or null.
* * false, if the predicate returns true at least once.
*
* You can instead enable Kleene logic by setting `ignoreUnknown = false`. In this case, this method returns
*
* * true, if the predicate always returns false.
* * false, if the predicate returns true at least once.
* * null, if the predicate never returns true, but at least once null.
*
* @param predicate The predicate to apply to each value.
* @param ignoreUnknown Whether to ignore cases where the truthiness of the predicate is unknown.
*
* @result noneSatisfyPredicate Whether no value in the column satisfies the predicate.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, null]);
* out column.none((cell) -> cell < 0);
* out column.none((cell) -> cell > 2);
* out column.none((cell) -> cell < 0, ignoreUnknown = false);
* out column.none((cell) -> cell > 2, ignoreUnknown = false);
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQGeneral)
fun none(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> noneSatisfyPredicate: Boolean?
/**
* Rename the column and return the result as a new column.
*
* **Note:** The original column is not modified.
*
* @param newName The new name of the column.
*
* @result newColumn A column with the new name.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.rename("b");
* }
*/
@Pure
@Category(DataScienceCategory.DataProcessingQColumn)
fun rename(
@PythonName("new_name") newName: String
) -> newColumn: Column<T>
/**
* Transform the values in the column and return the result as a new column.
*
* **Note:** The original column is not modified.
*
* @param transformer The transformer to apply to each value.
*
* @result newColumn A column with the transformed values.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.transform((cell) -> 2 * cell);
* }
*/
@Pure
@Category(DataScienceCategory.DataProcessingQColumn)
fun transform<R>(
transformer: (cell: Cell<T>) -> transformedCell: Cell<R>
) -> newColumn: Column<R>
/**
* Return a table with important statistics about the column.
*
* !!! warning "API Stability"
*
* Do not rely on the exact output of this method. In future versions, we may change the displayed statistics
* without prior notice.
*
* @result statistics The table with statistics.
*
* @example
* pipeline example {
* val column = Column("a", [1, 3]);
* out column.summarizeStatistics();
* }
*/
@Pure
@PythonName("summarize_statistics")
fun summarizeStatistics() -> statistics: Table
/**
* Calculate the Pearson correlation between this column and another column.
*
* The Pearson correlation is a value between -1 and 1 that indicates how much the two columns are **linearly**
* related:
*
* - A correlation of -1 indicates a perfect negative linear relationship.
* - A correlation of 0 indicates no linear relationship.
* - A correlation of 1 indicates a perfect positive linear relationship.
*
* A value of 0 does not necessarily mean that the columns are independent. It only means that there is no linear
* relationship between the columns.
*
* @param other The other column to calculate the correlation with.
*
* @result correlation The Pearson correlation between the two columns.
*
* @example
* pipeline example {
* val column1 = Column("a", [1, 2, 3]);
* val column2 = Column("a", [2, 4, 6]);
* out column1.correlationWith(column2);
* }
*
* @example
* pipeline example {
* val column1 = Column("a", [1, 2, 3]);
* val column2 = Column("a", [3, 2, 1]);
* out column1.correlationWith(column2);
* }
*/
@Pure
@PythonName("correlation_with")
@Category(DataScienceCategory.DataExplorationQMetric)
fun correlationWith(
other: Column<Any>
) -> correlation: Float
/**
* Return the number of distinct values in the column.
*
* @param ignoreMissingValues Whether to ignore missing values when counting distinct values.
*
* @result distinctValueCount The number of distinct values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, 2, null]);
* out column.distinctValueCount();
* out column.distinctValueCount(ignoreMissingValues = false);
* }
*/
@Pure
@PythonName("distinct_value_count")
@Category(DataScienceCategory.DataExplorationQMetric)
fun distinctValueCount(
@PythonName("ignore_missing_values") ignoreMissingValues: Boolean = true
) -> distinctValueCount: Int
/**
* Return the idness of this column.
*
* We define the idness as the number of distinct values (including missing values) divided by the number of rows.
* If the column is empty, the idness is 1.0.
*
* A high idness indicates that most values in the column are unique. In this case, you must be careful when using
* the column for analysis, as a model might learn a mapping from this column to the target, which might not
* generalize well. You can generally ignore this metric for floating point columns.
*
* @result idness The idness of the column.
*
* @example
* pipeline example {
* val column1 = Column("a", [1, 2, 3]);
* out column1.idness();
* }
*
* @example
* pipeline example {
* val column2 = Column("a", [1, 2, 3, 2]);
* out column2.idness();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun idness() -> idness: Float
/**
* Return the maximum value in the column.
*
* @result max The maximum value in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.max();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun max() -> max: T?
/**
* Return the mean of the values in the column.
*
* The mean is the sum of the values divided by the number of values.
*
* @result mean The mean of the values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.mean();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun mean() -> mean: T
/**
* Return the median of the values in the column.
*
* The median is the value in the middle of the sorted list of values. If the number of values is even, the median
* is the mean of the two middle values.
*
* @result median The median of the values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.median();
* }
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3, 4]);
* out column.median();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun median() -> median: T
/**
* Return the minimum value in the column.
*
* @result min The minimum value in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.min();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun min() -> min: T?
/**
* Return the number of missing values in the column.
*
* @result missingValueCount The number of missing values in the column.
*
* @example
* pipeline example {
* val column1 = Column("a", [1, 2, 3]);
* out column1.missingValueCount();
* }
*
* @example
* pipeline example {
* val column2 = Column("a", [1, null, 3]);
* out column2.missingValueCount();
* }
*/
@Pure
@PythonName("missing_value_count")
@Category(DataScienceCategory.DataExplorationQMetric)
fun missingValueCount() -> missingValueCount: Int
/**
* Return the missing value ratio.
*
* We define the missing value ratio as the number of missing values in the column divided by the number of rows.
* If the column is empty, the missing value ratio is 1.0.
*
* A high missing value ratio indicates that the column is dominated by missing values. In this case, the column
* may not be useful for analysis.
*
* @result missingValueRatio The ratio of missing values in the column.
*
* @example
* pipeline example {
* val column1 = Column("a", [1, 2, 3]);
* out column1.missingValueRatio();
* }
*
* @example
* pipeline example {
* val column2 = Column("a", [1, null]);
* out column2.missingValueRatio();
* }
*
* @example
* pipeline example {
* val column3 = Column("a", []);
* out column3.missingValueRatio();
* }
*/
@Pure
@PythonName("missing_value_ratio")
@Category(DataScienceCategory.DataExplorationQMetric)
fun missingValueRatio() -> missingValueRatio: Float
/**
* Return the mode of the values in the column.
*
* The mode is the value that appears most frequently in the column. If multiple values occur equally often, all
* of them are returned. The values are sorted in ascending order.
*
* @param ignoreMissingValues Whether to ignore missing values.
*
* @result mode The mode of the values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [3, 1, 2, 1, 3]);
* out column.mode();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun mode(
@PythonName("ignore_missing_values") ignoreMissingValues: Boolean = true
) -> mode: List<T?>
/**
* Return the stability of the column.
*
* We define the stability as the number of occurrences of the most common non-missing value divided by the total
* number of non-missing values. If the column is empty or all values are missing, the stability is 1.0.
*
* A high stability indicates that the column is dominated by a single value. In this case, the column may not be
* useful for analysis.
*
* @result stability The stability of the column.
*
* @example
* pipeline example {
* val column1 = Column("a", [1, 1, 2, 3, null]);
* out column1.stability();
* }
*
* @example
* pipeline example {
* val column2 = Column("a", [1, 1, 1, 1]);
* out column2.stability();
* }
*
* @example
* pipeline example {
* val column3 = Column("a", []);
* out column3.stability();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun stability() -> stability: Float
/**
* Return the standard deviation of the values in the column.
*
* The standard deviation is the square root of the variance.
*
* @result standardDeviation The standard deviation of the values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.standardDeviation();
* }
*/
@Pure
@PythonName("standard_deviation")
@Category(DataScienceCategory.DataExplorationQMetric)
fun standardDeviation() -> standardDeviation: Float
/**
* Return the variance of the values in the column.
*
* The variance is the sum of the squared differences from the mean divided by the number of values minus one.
*
* @result variance The variance of the values in the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.variance();
* }
*/
@Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun variance() -> variance: Float
/**
* Return the values of the column in a list.
*
* @result values The values of the column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.toList();
* }
*/
@Pure
@PythonName("to_list")
@Category(DataScienceCategory.UtilitiesQConversion)
fun toList() -> values: List<T>
/**
* Create a table that contains only this column.
*
* @result table The table with this column.
*
* @example
* pipeline example {
* val column = Column("a", [1, 2, 3]);
* out column.toTable();
* }
*/
@Pure
@PythonName("to_table")
@Category(DataScienceCategory.UtilitiesQConversion)
fun toTable() -> table: Table
}
|
name
The name of the column.
Type: String
plot
The plotter for the column.
Call methods of the plotter to create various plots for the column.
Type: ColumnPlotter
rowCount
The number of rows.
Note: This operation must fully load the data into memory, which can be expensive.
Type: Int
type
The type of the column.
Type: ColumnType
all
Check whether all values in the column satisfy the predicate.
The predicate can return one of three values:
- true, if the value satisfies the predicate.
- false, if the value does not satisfy the predicate.
- null, if the truthiness of the predicate is unknown, e.g. due to missing values.
By default, cases where the truthiness of the predicate is unknown are ignored and this method returns
- true, if the predicate always returns true or null.
- false, if the predicate returns false at least once.
You can instead enable Kleene logic by setting ignoreUnknown = false. In this case, this method returns
- true, if the predicate always returns true.
- false, if the predicate returns false at least once.
- null, if the predicate never returns false, but at least once null.
Parameters:
| Name |
Type |
Description |
Default |
predicate |
(cell: Cell<T>) -> (satisfiesPredicate: Cell<Boolean?>) |
The predicate to apply to each value. |
- |
ignoreUnknown |
Boolean |
Whether to ignore cases where the truthiness of the predicate is unknown. |
true |
Results:
| Name |
Type |
Description |
allSatisfyPredicate |
Boolean? |
Whether all values in the column satisfy the predicate. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3, null]);
out column.all((cell) -> cell > 0);
out column.all((cell) -> cell < 3);
out column.all((cell) -> cell > 0, ignoreUnknown = false);
out column.all((cell) -> cell < 3, ignoreUnknown = false);
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQGeneral)
fun all(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> allSatisfyPredicate: Boolean?
|
any
Check whether any value in the column satisfies the predicate.
The predicate can return one of three values:
- true, if the value satisfies the predicate.
- false, if the value does not satisfy the predicate.
- null, if the truthiness of the predicate is unknown, e.g. due to missing values.
By default, cases where the truthiness of the predicate is unknown are ignored and this method returns
- true, if the predicate returns true at least once.
- false, if the predicate always returns false or null.
You can instead enable Kleene logic by setting ignoreUnknown = false. In this case, this method returns
- true, if the predicate returns true at least once.
- false, if the predicate always returns false.
- null, if the predicate never returns true, but at least once null.
Parameters:
| Name |
Type |
Description |
Default |
predicate |
(cell: Cell<T>) -> (satisfiesPredicate: Cell<Boolean?>) |
The predicate to apply to each value. |
- |
ignoreUnknown |
Boolean |
Whether to ignore cases where the truthiness of the predicate is unknown. |
true |
Results:
| Name |
Type |
Description |
anySatisfyPredicate |
Boolean? |
Whether any value in the column satisfies the predicate. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3, null]);
out column.any((cell) -> cell > 2);
out column.any((cell) -> cell < 0);
out column.any((cell) -> cell > 2, ignoreUnknown = false);
out column.any((cell) -> cell < 0, ignoreUnknown = false);
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQGeneral)
fun any(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> anySatisfyPredicate: Boolean?
|
correlationWith
Calculate the Pearson correlation between this column and another column.
The Pearson correlation is a value between -1 and 1 that indicates how much the two columns are linearly
related:
- A correlation of -1 indicates a perfect negative linear relationship.
- A correlation of 0 indicates no linear relationship.
- A correlation of 1 indicates a perfect positive linear relationship.
A value of 0 does not necessarily mean that the columns are independent. It only means that there is no linear
relationship between the columns.
Parameters:
| Name |
Type |
Description |
Default |
other |
Column<Any> |
The other column to calculate the correlation with. |
- |
Results:
| Name |
Type |
Description |
correlation |
Float |
The Pearson correlation between the two columns. |
Examples:
pipeline example {
val column1 = Column("a", [1, 2, 3]);
val column2 = Column("a", [2, 4, 6]);
out column1.correlationWith(column2);
}
pipeline example {
val column1 = Column("a", [1, 2, 3]);
val column2 = Column("a", [3, 2, 1]);
out column1.correlationWith(column2);
}
Stub code in Column.sdsstub
| @Pure
@PythonName("correlation_with")
@Category(DataScienceCategory.DataExplorationQMetric)
fun correlationWith(
other: Column<Any>
) -> correlation: Float
|
countIf
Count how many values in the column satisfy the predicate.
The predicate can return one of three results:
- true, if the value satisfies the predicate.
- false, if the value does not satisfy the predicate.
- null, if the truthiness of the predicate is unknown, e.g. due to missing values.
By default, cases where the truthiness of the predicate is unknown are ignored and this method returns how
often the predicate returns true.
You can instead enable Kleene logic by setting ignoreUnknown = false. In this case, this method returns null if
the predicate returns null at least once. Otherwise, it still returns how often the predicate returns true.
Parameters:
| Name |
Type |
Description |
Default |
predicate |
(cell: Cell<T>) -> (satisfiesPredicate: Cell<Boolean?>) |
The predicate to apply to each value. |
- |
ignoreUnknown |
Boolean |
Whether to ignore cases where the truthiness of the predicate is unknown. |
true |
Results:
| Name |
Type |
Description |
count |
Int? |
The number of values in the column that satisfy the predicate. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3, null]);
out column.countIf((cell) -> cell > 1);
out column.countIf((cell) -> cell < 0, ignoreUnknown = false);
}
Stub code in Column.sdsstub
| @Pure
@PythonName("count_if")
fun countIf(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> count: Int?
|
distinctValueCount
Return the number of distinct values in the column.
Parameters:
| Name |
Type |
Description |
Default |
ignoreMissingValues |
Boolean |
Whether to ignore missing values when counting distinct values. |
true |
Results:
| Name |
Type |
Description |
distinctValueCount |
Int |
The number of distinct values in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3, 2, null]);
out column.distinctValueCount();
out column.distinctValueCount(ignoreMissingValues = false);
}
Stub code in Column.sdsstub
| @Pure
@PythonName("distinct_value_count")
@Category(DataScienceCategory.DataExplorationQMetric)
fun distinctValueCount(
@PythonName("ignore_missing_values") ignoreMissingValues: Boolean = true
) -> distinctValueCount: Int
|
getDistinctValues
Return the distinct values in the column.
Parameters:
| Name |
Type |
Description |
Default |
ignoreMissingValues |
Boolean |
Whether to ignore missing values. |
true |
Results:
| Name |
Type |
Description |
distinctValues |
List<T?> |
The distinct values in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3, 2]);
out column.getDistinctValues();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("get_distinct_values")
fun getDistinctValues(
@PythonName("ignore_missing_values") ignoreMissingValues: Boolean = true
) -> distinctValues: List<T?>
|
getValue
Return the column value at specified index. This is equivalent to the [] operator (indexed access).
Nonnegative indices are counted from the beginning (starting at 0), negative indices from the end (starting at
-1).
Parameters:
| Name |
Type |
Description |
Default |
index |
Int |
Index of requested value. |
- |
Results:
| Name |
Type |
Description |
value |
T |
Value at index. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.getValue(0);
out column[0];
out column.getValue(-1);
out column[-1];
}
Stub code in Column.sdsstub
| @Pure
@PythonName("get_value")
fun getValue(
index: Int
) -> value: T
|
idness
Return the idness of this column.
We define the idness as the number of distinct values (including missing values) divided by the number of rows.
If the column is empty, the idness is 1.0.
A high idness indicates that most values in the column are unique. In this case, you must be careful when using
the column for analysis, as a model might learn a mapping from this column to the target, which might not
generalize well. You can generally ignore this metric for floating point columns.
Results:
| Name |
Type |
Description |
idness |
Float |
The idness of the column. |
Examples:
pipeline example {
val column1 = Column("a", [1, 2, 3]);
out column1.idness();
}
pipeline example {
val column2 = Column("a", [1, 2, 3, 2]);
out column2.idness();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun idness() -> idness: Float
|
max
Return the maximum value in the column.
Results:
| Name |
Type |
Description |
max |
T? |
The maximum value in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.max();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun max() -> max: T?
|
mean
Return the mean of the values in the column.
The mean is the sum of the values divided by the number of values.
Results:
| Name |
Type |
Description |
mean |
T |
The mean of the values in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.mean();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun mean() -> mean: T
|
Return the median of the values in the column.
The median is the value in the middle of the sorted list of values. If the number of values is even, the median
is the mean of the two middle values.
Results:
| Name |
Type |
Description |
median |
T |
The median of the values in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.median();
}
pipeline example {
val column = Column("a", [1, 2, 3, 4]);
out column.median();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun median() -> median: T
|
min
Return the minimum value in the column.
Results:
| Name |
Type |
Description |
min |
T? |
The minimum value in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.min();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun min() -> min: T?
|
missingValueCount
Return the number of missing values in the column.
Results:
| Name |
Type |
Description |
missingValueCount |
Int |
The number of missing values in the column. |
Examples:
pipeline example {
val column1 = Column("a", [1, 2, 3]);
out column1.missingValueCount();
}
pipeline example {
val column2 = Column("a", [1, null, 3]);
out column2.missingValueCount();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("missing_value_count")
@Category(DataScienceCategory.DataExplorationQMetric)
fun missingValueCount() -> missingValueCount: Int
|
missingValueRatio
Return the missing value ratio.
We define the missing value ratio as the number of missing values in the column divided by the number of rows.
If the column is empty, the missing value ratio is 1.0.
A high missing value ratio indicates that the column is dominated by missing values. In this case, the column
may not be useful for analysis.
Results:
| Name |
Type |
Description |
missingValueRatio |
Float |
The ratio of missing values in the column. |
Examples:
pipeline example {
val column1 = Column("a", [1, 2, 3]);
out column1.missingValueRatio();
}
pipeline example {
val column2 = Column("a", [1, null]);
out column2.missingValueRatio();
}
pipeline example {
val column3 = Column("a", []);
out column3.missingValueRatio();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("missing_value_ratio")
@Category(DataScienceCategory.DataExplorationQMetric)
fun missingValueRatio() -> missingValueRatio: Float
|
mode
Return the mode of the values in the column.
The mode is the value that appears most frequently in the column. If multiple values occur equally often, all
of them are returned. The values are sorted in ascending order.
Parameters:
| Name |
Type |
Description |
Default |
ignoreMissingValues |
Boolean |
Whether to ignore missing values. |
true |
Results:
| Name |
Type |
Description |
mode |
List<T?> |
The mode of the values in the column. |
Examples:
pipeline example {
val column = Column("a", [3, 1, 2, 1, 3]);
out column.mode();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun mode(
@PythonName("ignore_missing_values") ignoreMissingValues: Boolean = true
) -> mode: List<T?>
|
none
Check whether no value in the column satisfies the predicate.
The predicate can return one of three values:
- true, if the value satisfies the predicate.
- false, if the value does not satisfy the predicate.
- null, if the truthiness of the predicate is unknown, e.g. due to missing values.
By default, cases where the truthiness of the predicate is unknown are ignored and this method returns
- true, if the predicate always returns false or null.
- false, if the predicate returns true at least once.
You can instead enable Kleene logic by setting ignoreUnknown = false. In this case, this method returns
- true, if the predicate always returns false.
- false, if the predicate returns true at least once.
- null, if the predicate never returns true, but at least once null.
Parameters:
| Name |
Type |
Description |
Default |
predicate |
(cell: Cell<T>) -> (satisfiesPredicate: Cell<Boolean?>) |
The predicate to apply to each value. |
- |
ignoreUnknown |
Boolean |
Whether to ignore cases where the truthiness of the predicate is unknown. |
true |
Results:
| Name |
Type |
Description |
noneSatisfyPredicate |
Boolean? |
Whether no value in the column satisfies the predicate. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3, null]);
out column.none((cell) -> cell < 0);
out column.none((cell) -> cell > 2);
out column.none((cell) -> cell < 0, ignoreUnknown = false);
out column.none((cell) -> cell > 2, ignoreUnknown = false);
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQGeneral)
fun none(
predicate: (cell: Cell<T>) -> satisfiesPredicate: Cell<Boolean?>,
@PythonName("ignore_unknown") ignoreUnknown: Boolean = true
) -> noneSatisfyPredicate: Boolean?
|
rename
Rename the column and return the result as a new column.
Note: The original column is not modified.
Parameters:
| Name |
Type |
Description |
Default |
newName |
String |
The new name of the column. |
- |
Results:
| Name |
Type |
Description |
newColumn |
Column<T> |
A column with the new name. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.rename("b");
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataProcessingQColumn)
fun rename(
@PythonName("new_name") newName: String
) -> newColumn: Column<T>
|
stability
Return the stability of the column.
We define the stability as the number of occurrences of the most common non-missing value divided by the total
number of non-missing values. If the column is empty or all values are missing, the stability is 1.0.
A high stability indicates that the column is dominated by a single value. In this case, the column may not be
useful for analysis.
Results:
| Name |
Type |
Description |
stability |
Float |
The stability of the column. |
Examples:
pipeline example {
val column1 = Column("a", [1, 1, 2, 3, null]);
out column1.stability();
}
pipeline example {
val column2 = Column("a", [1, 1, 1, 1]);
out column2.stability();
}
pipeline example {
val column3 = Column("a", []);
out column3.stability();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun stability() -> stability: Float
|
standardDeviation
Return the standard deviation of the values in the column.
The standard deviation is the square root of the variance.
Results:
| Name |
Type |
Description |
standardDeviation |
Float |
The standard deviation of the values in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.standardDeviation();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("standard_deviation")
@Category(DataScienceCategory.DataExplorationQMetric)
fun standardDeviation() -> standardDeviation: Float
|
summarizeStatistics
Return a table with important statistics about the column.
API Stability
Do not rely on the exact output of this method. In future versions, we may change the displayed statistics
without prior notice.
Results:
| Name |
Type |
Description |
statistics |
Table |
The table with statistics. |
Examples:
pipeline example {
val column = Column("a", [1, 3]);
out column.summarizeStatistics();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("summarize_statistics")
fun summarizeStatistics() -> statistics: Table
|
toList
Return the values of the column in a list.
Results:
| Name |
Type |
Description |
values |
List<T> |
The values of the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.toList();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("to_list")
@Category(DataScienceCategory.UtilitiesQConversion)
fun toList() -> values: List<T>
|
toTable
Create a table that contains only this column.
Results:
| Name |
Type |
Description |
table |
Table |
The table with this column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.toTable();
}
Stub code in Column.sdsstub
| @Pure
@PythonName("to_table")
@Category(DataScienceCategory.UtilitiesQConversion)
fun toTable() -> table: Table
|
Transform the values in the column and return the result as a new column.
Note: The original column is not modified.
Parameters:
| Name |
Type |
Description |
Default |
transformer |
(cell: Cell<T>) -> (transformedCell: Cell<R>) |
The transformer to apply to each value. |
- |
Results:
| Name |
Type |
Description |
newColumn |
Column<R> |
A column with the transformed values. |
Type parameters:
| Name |
Upper Bound |
Description |
Default |
R |
Any? |
- |
- |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.transform((cell) -> 2 * cell);
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataProcessingQColumn)
fun transform<R>(
transformer: (cell: Cell<T>) -> transformedCell: Cell<R>
) -> newColumn: Column<R>
|
variance
Return the variance of the values in the column.
The variance is the sum of the squared differences from the mean divided by the number of values minus one.
Results:
| Name |
Type |
Description |
variance |
Float |
The variance of the values in the column. |
Examples:
pipeline example {
val column = Column("a", [1, 2, 3]);
out column.variance();
}
Stub code in Column.sdsstub
| @Pure
@Category(DataScienceCategory.DataExplorationQMetric)
fun variance() -> variance: Float
|