pyspark.sql.DataFrame.select¶
-
DataFrame.
select
(*cols: ColumnOrName) → DataFrame¶ Projects a set of expressions and returns a new
DataFrame
.- Parameters
Examples
>>> df.select('*').collect() [Row(age=2, name='Alice'), Row(age=5, name='Bob')] >>> df.select('name', 'age').collect() [Row(name='Alice', age=2), Row(name='Bob', age=5)] >>> df.select(df.name, (df.age + 10).alias('age')).collect() [Row(name='Alice', age=12), Row(name='Bob', age=15)]