Member-only story

Pandas’ append() function is deprecated, and here’s what to use instead

Crystal X
2 min readMay 7, 2023

--

One thing that I try to do is to enter as many Kaggle competitions as I can to help me improve my skills in machine learning.

I have recentered a community competition about the weather and decided that since the target is a binary classification problem, I would use a classification model from sklearn. Because there were so many missing values in both the train and test dataset, I decided the best approach would be to append the test dataframe to the train dataframe, as indicated by the code below:-

Imagine my surprise when I ran the code and received a future warning that the append() function is deprecated and will be removed from pandas in a future version.

The code that is supposed to be used instead is pd.concat, which can be reviewed in the attached link:- https://pandas.pydata.org/docs/reference/api/pandas.concat.html

The code below represents how to use pandas’ concat() function:-

--

--

Crystal X
Crystal X

Written by Crystal X

I have over five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.

Responses (1)