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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -