[Solved] frame.append method is deprecated and will be removed from pandas

thumbnail

Code:

all_results = all_results.append(current_result)


Error:

/var/folders/wh/tdg0ff9s1wl59234d5l27_gc0000gn/T/ipykernel_98654/2691205834.py:15: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
  all_results = all_results.append(current_result)


Fix:

all_results = pd.concat([all_results, current_result])

This warning appears because DataFrame.append was deprecated and later removed from pandas, so code that built a frame by appending one row or frame at a time needs updating.

The replacement is pandas.concat, which combines a list of frames in one call. Collecting the pieces in a list and concatenating once at the end is also faster than repeated appends.

Comments

Popular posts from this blog

[Solved] Error: No such keg: /usr/local/Cellar/gcc

[How To] Unfollow Non-followers on Instagram