rasbt / machine-learning-book

Code Repository for Machine Learning with PyTorch and Scikit-Learn
https://sebastianraschka.com/books/#machine-learning-with-pytorch-and-scikit-learn
MIT License
3.39k stars 1.24k forks source link

Apply pandas append fix to ch08 python script #183

Closed rasbt closed 2 months ago

rasbt commented 2 months ago

Pandas deprecated the .append method, and there was a fix for that in the chapter 8 notebook:

            if version.parse(pd.__version__) >= version.parse("1.3.2"):
                x = pd.DataFrame([[txt, labels[l]]], columns=['review', 'sentiment'])
                df = pd.concat([df, x], ignore_index=False)

            else:
                df = df.append([[txt, labels[l]]], 
                               ignore_index=True)

However, the fix was missing in the accompanying Python script.

Fixes #182