apply function and def

PHOTO EMBED

Tue Jun 29 2021 16:32:19 GMT+0000 (UTC)

Saved by @Quinn #py #dataframe #pandas

rmsval = df.loc[:, 'c1':'c4']
def getrms(row):  
  a = np.sqrt(sum(row**2/4))
  return a
df['rms'] = df.apply(getrms,axis=1)
df.head()
content_copyCOPY