KT AICE Associate 실습을 진행하던 도중 아래의 오류가 발생하였다.
for i in np.arange(len(json_data)):
if json_data[i].json()['documents'] != []:
address_data = address_data.append(
[(json_data[i].json()['documents'][0]['road_address']['address_name'],
json_data[i].json()['documents'][0]['road_address']['x'],
json_data[i].json()['documents'][0]['road_address']['y'])],
ignore_index=True)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
AttributeError: 'DataFrame' object has no attribute 'append'
https://stackoverflow.com/questions/75956209/error-dataframe-object-has-no-attribute-append
pandas 2.0, append (previously deprecated) was removed.
You need to use concat instead
for i in np.arange(len(json_data)):
if json_data[i].json()['documents'] != []:
address_name = json_data[i].json(
)['documents'][0]['road_address']['address_name']
x = json_data[i].json()['documents'][0]['road_address']['x']
y = json_data[i].json()['documents'][0]['road_address']['y']
new_data = pd.DataFrame(
{'address_name': [address_name], 'x': [x], 'y': [y]})
address_data = pd.concat([address_data, new_data], ignore_index=True)