python - Various ways to assign multiple columns to existing pandas dataframe -
i have 3 lists of numerical values:
jac = [0.66,0.8,0.2,0.5,0.3] sor = [0.8,0.8,0.2,0.5,0.7] diff = [1,0.8,0.2,0.5,0.5]
and existing pandas dataframe (df):
ham 0 0.5 1 0.6 2 0.6 3 0.7 4 0.9
the following solution
df.assign(diff=diffl).assign(sor=sor).assign(jac=jac)
what various ways append these lists in 1 shot ?
you can this:
df.assign(diff=diffl,sor=sor,jac=jac)
wiki
Comments
Post a Comment