“Agreguj na całej ramce danych bez grupy” Kod odpowiedzi

Agreguj na całej ramce danych bez grupy

# Aggregate on the entire DataFrame without group

df.agg({"age": "max"}).collect()
# [Row(max(age)=5)]
from pyspark.sql import functions as F
df.agg(F.min(df.age)).collect()
# [Row(min(age)=2)]
Ethercourt.ml

Agreguj na całej ramce danych bez grupy


def describe(df):
    funcs = dict(Kurt=lambda x: x.kurt(),
                 Skew='skew',
                 Mean='mean',
                 Std='std')
    funcs_for_all = {k: funcs for k in df.columns}
    return df.groupby(lambda _ : True).agg(funcs_for_all).iloc[0].unstack().T

describe(df)

Xanthous Xenomorph

Odpowiedzi podobne do “Agreguj na całej ramce danych bez grupy”

Pytania podobne do “Agreguj na całej ramce danych bez grupy”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu