“Pandas anwenden Ausgabe mehrere Spalten” Code-Antworten

Pandas anwenden Ausgabe mehrere Spalten

df = pd.DataFrame(np.random.randint(0,10,(10,2)), columns=["random", "a"])
df[["sq_a","cube_a"]] = df.apply(lambda x: [x.a**2, x.a**3], axis=1, result_type="expand")
Important Ibex

Pandas anwenden Ausgabe mehrere Spalten

>>> appiled_df = df.apply(lambda row: fn(row.text), axis='columns', result_type='expand')
>>> df = pd.concat([df, appiled_df], axis='columns')
Dead Dolphin

Ähnliche Antworten wie “Pandas anwenden Ausgabe mehrere Spalten”

Fragen ähnlich wie “Pandas anwenden Ausgabe mehrere Spalten”

Weitere verwandte Antworten zu “Pandas anwenden Ausgabe mehrere Spalten” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen