목록 (list_addresses)에서 데이터를 가져 와서 데이터 프레임의 다른 열 (dfloc)에 채우려고합니다. 아래 코드를 사용합니다. 어디서 잘못 될지 잘 모릅니다.pandas 데이터 프레임의 개별 열에 데이터 채우기
값은 list_address에는 있지만 데이터 프레임에는 채워지지 않습니다.
도움을 주시면 감사하겠습니다. 당신이 [(LAT1, Lon1), (LAT2, Lon2), 등등 ...]의 형태와리스트 나 튜플의리스트를 가지고있는 것처럼
for index in range(len(list_addresses)):
location = geolocator.reverse([list_addresses[index][0],list_addresses[index][1]])
dfloc.loc[dfloc.Latitude] = list_addresses[index][0]
dfloc.loc[dfloc.Longitude] = list_addresses[index][1]
dfloc.loc[dfloc.Address] = location.address
두 번째'dfloc' 제거하십시오 -'dfloc.loc를 [ '위도'] = list_addresses [인덱스] [0] '또는 'dfloc [ 'Latitude'] = list_addresses [index] [0]' – jezrael
@ jezrael : 이전에 해봤지만 작동하지 않았다. 그러나 목록의 값을 인쇄 할 때 올바르게 인쇄됩니다. – user3447653
데이터가 없기 때문에 문제가되는 테스트입니다. 가능한 경우'geolocator.reverse'를 설명 할 때'dfloc','list_addresses' 샘플을 추가 할 수 있습니다. 나는 당신이 더 나은 테스트를 위해 문제를 단순화 할 수 있다고 생각합니다. – jezrael