2024-05-15 17:24:44 发布
网友
我有一个很大的数据框,其中一个名为location的列只包含少数城市,例如:["New York", "London", "Paris", "Berlin"...]。在
location
["New York", "London", "Paris", "Berlin"...]
例如,我想知道的是,在这样一个列中,我想知道的是,所有的值都是不一样的。既然.describe('location')方法没有帮助,我该怎么做呢?在
.describe('location')
describe方法用于基本的预定义统计信息,如count、mean、std、min、max等。但是,为了找到任何列的不同值,可以使用distinct()方法。在
希望这有帮助。在
谨致问候
尼拉吉
我发现了:
df.groupBy("location").count().show()
这样您就不能打印列location中的不同值
from pyspark.sql import functions as F df.select(F.col('location')).distinct()
describe方法用于基本的预定义统计信息,如count、mean、std、min、max等。但是,为了找到任何列的不同值,可以使用distinct()方法。在
希望这有帮助。在
谨致问候
尼拉吉
我发现了:
这样您就不能打印列
location
中的不同值相关问题 更多 >
编程相关推荐