Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

assign multiple columns pandas

import pandas as pd

df = {'col_1': [0, 1, 2, 3],
        'col_2': [4, 5, 6, 7]}
df = pd.DataFrame(df)

df[[ 'column_new_1', 'column_new_2','column_new_3']] = [np.nan, 'dogs',3]  #thought this wo
Source by www.edureka.co #
 
PREVIOUS NEXT
Tagged: #assign #multiple #columns #pandas
ADD COMMENT
Topic
Name
5+7 =