创建测试dataframe:
>>> import pandas as pd
>>> df = pd.DataFrame([{'a':1, 'b':2}, {'a':3, 'b':4}])
>>> df
a b
0 1 2
1 3 4
添加两个空列
>>> df[['c','d']]=df.apply(lambda x:('',''),axis=1,result_type='expand')
>>> df
a b c d
0 1 2
1 3 4
当然,一列一列添加也是可以的
>>> df['c'] = ''
>>> df['d'] = ''
但如果这样
>>> df[['c', 'd']] = ''
KeyError: "None of [Index(['c', 'd'], dtype='object')] are in the [columns]"