나는 두 개의 데이터 프레임 A와 B를 가지고 있습니다. 데이터 프레임에서 두 개의 열 값과 필드. B 데이터 프레임에는 값과 필드 열도 있습니다. B의 '값' 열을 'Filed' 열의 A와 일치시키고 싶습니다. A의 Filed를 B의 값으로 바꿉니다. 답=
Value Filed
valid username username
valid username input_txtuserid
Password input_txtpassword
Password txtPassword
Login input_submit_log_in
LOG IN SIGNIN
B=
Value Filed
input_txtuserid "JOHN"
input_txtpassword "78945"
input_submit_log_in "Sucessfully"
Password txtPassword
City "London"
PLACE "4-A avenue Street"
내 데이터 프레임 C가 다음과 같이 보이길 원합니다.
C=
Value Filed
valid username "JOHN"
Password "78945"
Login "Sucessfully"
아래 code를 작성했지만 KeyError: 'City',
_map= dict(zip(A.Filed.values, A.Value.values))
def get_correct_value(행, _map=_map):
new_value= _map[row.Value]
filed= row.Filed
return new_value, filed
C= B.apply(get_correct_value, axis=1, result_type='확장')
C.columns= ['값','파일링됨']
A 데이터 프레임에서 사용할 수 없는 키워드를 무시하고 싶습니다. '