---
title: select
description: "DataFrame.select method in PySpark: Projects a set of expressions and returns a new DataFrame."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/dataframe/select
---

# select

Projects a set of expressions and returns a new DataFrame.

## Syntax

```
select(*cols: "ColumnOrName")
```

## Parameters

| Parameter | Type                 | Description                                                                                                                                                 |
| --------- | -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `cols`    | str, Column, or list | column names (string) or expressions (Column). If one of the column names is '\*', that column is expanded to include all columns in the current DataFrame. |

## Returns

`DataFrame`: A DataFrame with subset (or all) of columns.

## Examples

```python
df = spark.createDataFrame([
    (2, "Alice"), (5, "Bob")], schema=["age", "name"])

df.select('*').show()
# +---+-----+
# |age| name|
# +---+-----+
# |  2|Alice|
# |  5|  Bob|
# +---+-----+

df.select(df.name, (df.age + 10).alias('age')).show()
# +-----+---+
# | name|age|
# +-----+---+
# |Alice| 12|
# |  Bob| 15|
# +-----+---+
```
