---
title: min (GroupedData)
description: "GroupedData.min method in PySpark: Computes the min value for each numeric column for each group."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/groupeddata/min
---

# min (GroupedData)

Computes the min value for each numeric column for each group.

## Syntax

```
min(*cols)
```

## Parameters

| Parameter | Type | Description                                    |
| --------- | ---- | ---------------------------------------------- |
| `cols`    | str  | Column names. Non-numeric columns are ignored. |

## Returns

`DataFrame`

## Examples

```python
df = spark.createDataFrame([
    (2, "Alice", 80), (3, "Alice", 100),
    (5, "Bob", 120), (10, "Bob", 140)], ["age", "name", "height"])

# Group-by name, and calculate the min of the age in each group.
df.groupBy("name").min("age").sort("name").show()
# +-----+--------+
# | name|min(age)|
# +-----+--------+
# |Alice|       2|
# |  Bob|       5|
# +-----+--------+

# Calculate the min of the age and height in all data.
df.groupBy().min("age", "height").show()
# +--------+-----------+
# |min(age)|min(height)|
# +--------+-----------+
# |       2|         80|
# +--------+-----------+
```
