0

For below code, I get an attribute error,

total_device_df = total_device_df.append(KatsRequest().parse_json_response(filename, device_names))

Error:

AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?

While I googled, it taught I need to update from total_device_df.append ---> total_device_df.concat as I am using Pandas Version: 2.0.1. Even though I changed to concat, I get the same attribute error for concat (AttributeError: 'DataFrame' object has no attribute 'concat')

What am I doing wrong?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
iltech
  • 183
  • 1
  • 2
  • 11
  • 1
    `concat` is not deprecated. Make sure to restart your notebook/script/shell and to ensure you have not modified the DataFrame object. If you doubles checked, please provide your python and pandas version and a **fully reproducible** example (imports/data/code) – mozway May 11 '23 at 09:47
  • `concat` isn't a dataframe function, it's a pandas function. By that I mean it's `pd.concat` instead of `total_device_df.concat`. Try doing `pd.concat([total_device_df, KatsRequest().parse_json_response(filename, device_names)])` – hostingutilities.com May 15 '23 at 21:40
  • result_df = result_df.append( {'DEVICE': Trona, 'POOL': somepoolname, 'DSN': 123x, 'STATUS': online, 'LAST UPDATED': updated, 'RUNNING TIME': 1, 'CONNECTED HOST': somehostname, 'HW_CONFIG': yes, 'USER': username}, ignore_index=True) print(result_df) The above throws, AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'? @mozway – iltech May 25 '23 at 08:37
  • Also since it is a Dictionary, I cant use append. – iltech May 25 '23 at 09:14

0 Answers0