这只是我拥有的某些csv的示例。
s.no names company_position
1 A Technical Recruiter
2 B Human Resource
3 B Corporate Trainer
4 C Recruiter
5 C English Teacher
我要输出
s.no names company_position company_position_1
1 A Technical Recruiter NAN
2 B Human Resource Corporate Trainer
3 C Recruiter English Teacher
我在name列中具有相同的值,但在company_position列中具有不同的值。我想在另一列中将=重复的name列的值放入另一个描述为company_position_1的列中
答案 0 :(得分:0)
import pandas as pd
data = [['A','Technical Recruiter'], ['B', 'HR Consultant','NAFTA'], \
['C', 'Executive Search Consultant Senior Technology Recruiter'], \
['D', 'Recruiter / HR Coordinator']]
df = pd.DataFrame(data, columns = ['Name', 'Current_position', 'Region'], index =
[1,2,3,4])
print(df)
输出将为
名称当前位置区域
1名技术招聘人员没有
2 B人力资源顾问NAFTA
3 C高级猎头顾问高级技术...无
4D招聘人员/人力资源协调员无
答案 1 :(得分:0)
import pandas as pd
data = [['A','Technical Recruiter'], ['B', 'HR Consultant','corporate Trainer'], \
['C', 'Recruiter','English Teacher']]
df = pd.DataFrame(data, columns = ['Name', 'Company_position','company_position1'],\
index = [1,2,3])
print(df)