【发布时间】:2017-05-24 10:43:06
【问题描述】:
我创建了以下 DataFrame:
purchase_1 = pd.Series({'Name': 'Chris',
'Item Purchased': 'Dog Food',
'Cost': 22.50})
purchase_2 = pd.Series({'Name': 'Kevyn',
'Item Purchased': 'Kitty Litter',
'Cost': 2.50})
purchase_3 = pd.Series({'Name': 'Vinod',
'Item Purchased': 'Bird Seed',
'Cost': 5.00})
df = pd.DataFrame([purchase_1, purchase_2, purchase_3], index=['Store 1', 'Store 1', 'Store 2'])
然后我添加了以下列:
df['Location'] = df.index
df
然后如何将以下系列添加到我的 DataFrame?谢谢。
s = pd.Series({'Name':'Kevyn', 'Item Purchased': 'Kitty Food', 'Cost': 3.00, 'Location': 'Store 2'})
【问题讨论】:
标签: pandas