【发布时间】:2018-07-28 13:28:21
【问题描述】:
name address contact_info
first_name last_name stret city mobile email
1 AAA BBB XXX YYY 02020 aaa@xyz.com
2 111 222 333 444 239393 bbb@xyz.com
我有一个上述格式的 excel。我想要的是在 name 中包含每一列,然后只有 contact_info 中的 mobile 列才会有人告诉我如何做到这一点。以下代码为我提供了 name 和 contact_info
中的所有内容import pandas as pd
df = pd.read_excel("test.xlsx", header=[0, 1], sheet_name="Mapping")
print df[["name", "contact_info"]]
我正在尝试得到这样的东西,
first_name last_name mobile
AAA BBB 102020
111 222 239393
【问题讨论】:
标签: python pandas dataframe slice